mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Conversion pipeline: Fix CSS styles applied to SVG elements being discarded
This commit is contained in:
parent
d4bc5a73fd
commit
f0ba30d7d3
@ -16,7 +16,7 @@ from css_parser.css import Property
|
|||||||
|
|
||||||
from calibre import guess_type
|
from calibre import guess_type
|
||||||
from calibre.ebooks import unit_convert
|
from calibre.ebooks import unit_convert
|
||||||
from calibre.ebooks.oeb.base import (XHTML, XHTML_NS, CSS_MIME, OEB_STYLES,
|
from calibre.ebooks.oeb.base import (XHTML, XHTML_NS, CSS_MIME, OEB_STYLES, SVG_NS,
|
||||||
namespace, barename, XPath, css_text)
|
namespace, barename, XPath, css_text)
|
||||||
from calibre.ebooks.oeb.stylizer import Stylizer
|
from calibre.ebooks.oeb.stylizer import Stylizer
|
||||||
from calibre.utils.filenames import ascii_filename, ascii_text
|
from calibre.utils.filenames import ascii_filename, ascii_text
|
||||||
@ -352,8 +352,7 @@ class CSSFlattener:
|
|||||||
cssdict[property] = "%0.5fem" % (value / fsize)
|
cssdict[property] = "%0.5fem" % (value / fsize)
|
||||||
|
|
||||||
def flatten_node(self, node, stylizer, names, styles, pseudo_styles, psize, item_id, recurse=True):
|
def flatten_node(self, node, stylizer, names, styles, pseudo_styles, psize, item_id, recurse=True):
|
||||||
if not isinstance(node.tag, string_or_bytes) \
|
if not isinstance(node.tag, string_or_bytes) or namespace(node.tag) not in (XHTML_NS, SVG_NS):
|
||||||
or namespace(node.tag) != XHTML_NS:
|
|
||||||
return
|
return
|
||||||
tag = barename(node.tag)
|
tag = barename(node.tag)
|
||||||
style = stylizer.style(node)
|
style = stylizer.style(node)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user