mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion pipeline: Don't fail if parsing extra css raises an exception. Instead just ignore it.
This commit is contained in:
parent
3f5e5875ea
commit
81b917db42
@ -168,12 +168,18 @@ class Stylizer(object):
|
|||||||
item.href))
|
item.href))
|
||||||
continue
|
continue
|
||||||
stylesheets.append(sitem.data)
|
stylesheets.append(sitem.data)
|
||||||
for x in (extra_css, user_css):
|
csses = {'extra_css':extra_css, 'user_css':user_css}
|
||||||
|
for w, x in csses.items():
|
||||||
if x:
|
if x:
|
||||||
text = XHTML_CSS_NAMESPACE + x
|
try:
|
||||||
stylesheet = parser.parseString(text, href=cssname)
|
text = XHTML_CSS_NAMESPACE + x
|
||||||
stylesheet.namespaces['h'] = XHTML_NS
|
stylesheet = parser.parseString(text, href=cssname)
|
||||||
stylesheets.append(stylesheet)
|
stylesheet.namespaces['h'] = XHTML_NS
|
||||||
|
stylesheets.append(stylesheet)
|
||||||
|
except:
|
||||||
|
self.logger.exception('Failed to parse %s, ignoring.'%w)
|
||||||
|
self.logger.debug('Bad css: ')
|
||||||
|
self.logger.debug(x)
|
||||||
rules = []
|
rules = []
|
||||||
index = 0
|
index = 0
|
||||||
self.stylesheets = set()
|
self.stylesheets = set()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user