mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
30b3d2a564
commit
30296b3426
@ -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)
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user