Fix svgdrawdoc for text containing XML invalid characters (#1110)
Fixes #11929
This commit is contained in:
@@ -31,7 +31,7 @@ SVG document generator.
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
from xml.sax.saxutils import escape
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Gramps modules
|
# Gramps modules
|
||||||
@@ -147,7 +147,7 @@ class SvgDrawDoc(BaseDoc, DrawDoc):
|
|||||||
linex = xpos + (width - self.string_width(font, line)) / 2
|
linex = xpos + (width - self.string_width(font, line)) / 2
|
||||||
self.buffer.write(
|
self.buffer.write(
|
||||||
'<tspan x="%4.2f" dy="%d">' % (linex, size) +
|
'<tspan x="%4.2f" dy="%d">' % (linex, size) +
|
||||||
line +
|
escape(line) +
|
||||||
'</tspan>'
|
'</tspan>'
|
||||||
)
|
)
|
||||||
self.buffer.write('</text>\n')
|
self.buffer.write('</text>\n')
|
||||||
@@ -273,7 +273,7 @@ class SvgDrawDoc(BaseDoc, DrawDoc):
|
|||||||
self.buffer.write(' font-family:serif;')
|
self.buffer.write(' font-family:serif;')
|
||||||
self.buffer.write(
|
self.buffer.write(
|
||||||
'">' +
|
'">' +
|
||||||
line +
|
escape(line) +
|
||||||
'</text>\n'
|
'</text>\n'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ class SvgDrawDoc(BaseDoc, DrawDoc):
|
|||||||
self.buffer.write('font-family:serif;')
|
self.buffer.write('font-family:serif;')
|
||||||
self.buffer.write(
|
self.buffer.write(
|
||||||
'">' +
|
'">' +
|
||||||
text +
|
escape(text) +
|
||||||
'</text>\n'
|
'</text>\n'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user