ODFDoc : issue 3187 : <, > and & should be escaped
svn: r13118
This commit is contained in:
parent
f1352ee2ee
commit
442eaf9923
@ -1216,6 +1216,9 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc):
|
||||
"""
|
||||
text = str(styledtext)
|
||||
s_tags = styledtext.get_tags()
|
||||
text = text.replace('&', '\1') # must be the first
|
||||
text = text.replace('<', '\2')
|
||||
text = text.replace('>', '\3')
|
||||
markuptext = self._backend.add_markup_from_styled(text, s_tags)
|
||||
# we need to know if we have new styles to add.
|
||||
# if markuptext contains : FontColor, FontFace, FontSize ...
|
||||
@ -1234,6 +1237,9 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc):
|
||||
start = m.end()
|
||||
linenb = 1
|
||||
self.start_paragraph(style_name)
|
||||
markuptext = markuptext.replace('\1', '&') # must be the first
|
||||
markuptext = markuptext.replace('\2', '<')
|
||||
markuptext = markuptext.replace('\3', '>')
|
||||
for line in markuptext.split('\n'):
|
||||
if ( linenb > 1 ):
|
||||
self.cntnt.write('<text:line-break/>')
|
||||
|
Loading…
Reference in New Issue
Block a user