TXT Input: Make preserve_spaces fast and only use   when necessary.

This commit is contained in:
John Schember 2011-01-27 20:24:12 -05:00
parent 6a5bf738f2
commit a7fe4ea5ed

View File

@ -103,7 +103,7 @@ def separate_paragraphs_print_formatted(txt):
return txt
def preserve_spaces(txt):
txt = txt.replace(' ', ' ')
txt = re.sub('(?P<space>[ ]{2,})', lambda mo: ' ' + ('&nbsp;' * (len(mo.group('space')) - 1)), txt)
txt = txt.replace('\t', '&nbsp;&nbsp;&nbsp;&nbsp;')
return txt