Fix display of preformatted notes in ODF output (#0001109).

svn: r8707
This commit is contained in:
Brian Matherly 2007-07-08 22:17:45 +00:00
parent 1c550c4c60
commit 06620b869e
2 changed files with 8 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2007-07-08 Brian Matherly <brian@gramps-project.org>
Robert Cawley <rjc@cawley.id.au>
* src/docgen/ODFDoc.py
(write_note): Fix display of preformatted notes (#0001109)
2007-07-08 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsDBDir.py (write_lock_file): Work around
os.getlogin() problem on some terminals.

View File

@ -64,7 +64,7 @@ _esc_map = {
'\x1a' : '',
'\x0c' : '',
'\n' : '<text:line-break/>',
'\t' : '<text:tab-stop/>',
'\t' : '<text:tab />',
'&lt;super&gt;' : '<text:span text:style-name="GSuper">',
'&lt;/super&gt;' : '</text:span>',
}
@ -861,21 +861,13 @@ class ODFDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc,BaseDoc.DrawDoc):
def write_note(self,text,format,style_name):
if format == 1:
text = text.replace('&','&amp;') # Must be first
text = text.replace('<','&lt;')
text = text.replace('>','&gt;')
text = escape(text,_esc_map)
# Replace multiple spaces: have to go from the largest number down
for n in range(text.count(' '),1,-1):
text = text.replace(' '*n, ' <text:s text:c="%d"/>' % (n-1) )
text = text.replace('\n','<text:line-break/>')
text = text.replace('\t','<text:tab-stop/>')
text = text.replace('&lt;super&gt;',
'<text:span text:style-name="GSuper">')
text = text.replace('&lt;/super&gt;','</text:span>')
self.start_paragraph(style_name)
self.cntnt.write('<text:span text:style-name="GRAMPS-preformat">')
self.cntnt.write(escape(text,_esc_map))
self.cntnt.write(text)
self.cntnt.write('</text:span>')
self.end_paragraph()
elif format == 0: