3969: [NarWeb] Narrated Web Site: Newlines and white space are not preserved in note text

Patch of Tim Lyons and  Benny Malengier


svn: r15923
This commit is contained in:
Benny Malengier
2010-09-23 21:03:15 +00:00
parent f748668c89
commit 0c5b792c76
8 changed files with 340 additions and 116 deletions

View File

@ -1335,10 +1335,12 @@ class CairoDoc(BaseDoc, TextDoc, DrawDoc):
#FIXME: following split should be regex to match \n\s*\n instead?
for line in markuptext.split('\n\n'):
self.start_paragraph(style_name)
#flowed, make normal whitespace go away
line = line.replace('\n',' ')
line = ' '.join(line.split())
self.__write_text(line, markup=True)
#flowed, normal whitespace goes away, but we keep linebreak
lines = line.split('\n')
newlines = []
for singleline in lines:
newlines.append(' '.join(singleline.split()))
self.__write_text('\n'.join(newlines), markup=True)
self.end_paragraph()
def __write_text(self, text, mark=None, markup=False):