MOBI Output: Fix regression that broke conversion of <svg> elements in the input document when the <svg> element was followed by non-whitespace text. Fixes #7083 (Problem to convert epub->mobi)

This commit is contained in:
Kovid Goyal 2010-10-17 09:24:45 -06:00
parent 30b3d2a564
commit 30296b3426
2 changed files with 3 additions and 3 deletions

View File

@ -282,9 +282,9 @@ def XPath(expr):
def xpath(elem, expr):
return elem.xpath(expr, namespaces=XPNSMAP)
def xml2str(root, pretty_print=False, strip_comments=False):
def xml2str(root, pretty_print=False, strip_comments=False, with_tail=True):
ans = etree.tostring(root, encoding='utf-8', xml_declaration=True,
pretty_print=pretty_print)
pretty_print=pretty_print, with_tail=with_tail)
if strip_comments:
ans = re.compile(r'<!--.*?-->', re.DOTALL).sub('', ans)

View File

@ -55,7 +55,7 @@ class SVGRasterizer(object):
self.rasterize_cover()
def rasterize_svg(self, elem, width=0, height=0, format='PNG'):
data = QByteArray(xml2str(elem))
data = QByteArray(xml2str(elem, with_tail=False))
svg = QSvgRenderer(data)
size = svg.defaultSize()
view_box = elem.get('viewBox', elem.get('viewbox', None))