[svn r37599] fixing a windows-error: i believe that most strings

passed into htmlgen.deindent() actually have
a normalized '\n' line-ending already (e.g. if they
come from python docstrings).  So the caller
now needs to specify otherwise.

--HG--
branch : trunk
This commit is contained in:
hpk 2007-01-30 15:08:47 +01:00
parent e96e4f61c7
commit 0b985318fa
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ sorted = py.builtin.sorted
html = py.xml.html html = py.xml.html
raw = py.xml.raw raw = py.xml.raw
def deindent(str, linesep=os.linesep): def deindent(str, linesep='\n'):
""" de-indent string """ de-indent string
can be used to de-indent Python docstrings, it de-indents the first can be used to de-indent Python docstrings, it de-indents the first
@ -26,7 +26,7 @@ def deindent(str, linesep=os.linesep):
# replace tabs with spaces, empty lines that contain spaces only, and # replace tabs with spaces, empty lines that contain spaces only, and
# find out what the smallest indentation is # find out what the smallest indentation is
for line in lines[1:]: for line in lines[1:]:
line = line.replace('\t', ' ') line = line.replace('\t', ' ' * 4)
stripped = line.strip() stripped = line.strip()
if not stripped: if not stripped:
normalized.append('') normalized.append('')