* 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>
|
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>
|
2005-07-29 Don Allingham <don@gramps-project.org>
|
||||||
* src/GrampsBSDDB.py: issue complete redraw on name grouping change
|
* src/GrampsBSDDB.py: issue complete redraw on name grouping change
|
||||||
|
@ -52,10 +52,18 @@ from ReportUtils import pt2cm
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
from xml.sax.saxutils import escape
|
||||||
|
|
||||||
_apptype = 'application/vnd.sun.xml.writer'
|
_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
|
# OpenOfficeDoc
|
||||||
@ -704,16 +712,12 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
|||||||
self.end_paragraph()
|
self.end_paragraph()
|
||||||
|
|
||||||
def write_text(self,text):
|
def write_text(self,text):
|
||||||
text = text.replace('&','&') # Must be first
|
"""
|
||||||
text = text.replace('<','<')
|
Uses the xml.sax.saxutils.escape function to convert XML
|
||||||
text = text.replace('>','>')
|
entities. The _esc_map dictionary allows us to add our own
|
||||||
text = text.replace('\x1a','')
|
mappings.
|
||||||
text = text.replace('\x0c','')
|
"""
|
||||||
text = text.replace('\n','<text:line-break/>')
|
self.cntnt.write(escape(text,_esc_map))
|
||||||
text = text.replace('<super>',
|
|
||||||
'<text:span text:style-name="GSuper">')
|
|
||||||
text = text.replace('</super>','</text:span>')
|
|
||||||
self.cntnt.write(text)
|
|
||||||
|
|
||||||
def _write_manifest(self):
|
def _write_manifest(self):
|
||||||
self.mfile = StringIO()
|
self.mfile = StringIO()
|
||||||
|
Loading…
Reference in New Issue
Block a user