* src/docgen/OpenOfficeDoc.org: remove ^L and ^Z from output, use
xml.sax.saxutils.escape to handle XML entities svn: r4984
This commit is contained in:
parent
d768deae74
commit
2070dcba43
@ -1,5 +1,6 @@
|
||||
2005-07-30 Don Allingham <don@gramps-project.org>
|
||||
* src/docgen/OpenOfficeDoc.org: remove ^L and ^Z from output
|
||||
* src/docgen/OpenOfficeDoc.org: remove ^L and ^Z from output, use
|
||||
xml.sax.saxutils.escape to handle XML entities
|
||||
|
||||
2005-07-29 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsBSDDB.py: issue complete redraw on name grouping change
|
||||
|
@ -52,10 +52,18 @@ from ReportUtils import pt2cm
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gettext import gettext as _
|
||||
|
||||
from xml.sax.saxutils import escape
|
||||
|
||||
_apptype = 'application/vnd.sun.xml.writer'
|
||||
|
||||
_esc_map = {
|
||||
'\x1a' : '',
|
||||
'\x0c' : '',
|
||||
'\n' : '<text:line-break/>',
|
||||
'<super>' : '<text:span text:style-name="GSuper">',
|
||||
'</super>' : '</text:span>')
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# OpenOfficeDoc
|
||||
@ -704,16 +712,12 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
||||
self.end_paragraph()
|
||||
|
||||
def write_text(self,text):
|
||||
text = text.replace('&','&') # Must be first
|
||||
text = text.replace('<','<')
|
||||
text = text.replace('>','>')
|
||||
text = text.replace('\x1a','')
|
||||
text = text.replace('\x0c','')
|
||||
text = text.replace('\n','<text:line-break/>')
|
||||
text = text.replace('<super>',
|
||||
'<text:span text:style-name="GSuper">')
|
||||
text = text.replace('</super>','</text:span>')
|
||||
self.cntnt.write(text)
|
||||
"""
|
||||
Uses the xml.sax.saxutils.escape function to convert XML
|
||||
entities. The _esc_map dictionary allows us to add our own
|
||||
mappings.
|
||||
"""
|
||||
self.cntnt.write(escape(text,_esc_map))
|
||||
|
||||
def _write_manifest(self):
|
||||
self.mfile = StringIO()
|
||||
|
Loading…
Reference in New Issue
Block a user