mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Edit Book: Remove unused CSS: Fix an erro if an HTML file links to a missing stylesheet
This commit is contained in:
parent
df29ce1116
commit
a6450d47a3
@ -184,8 +184,9 @@ def remove_unused_css(container, report, remove_unused_classes=False):
|
|||||||
|
|
||||||
for link in root.xpath('//*[local-name()="link" and @href]'):
|
for link in root.xpath('//*[local-name()="link" and @href]'):
|
||||||
sname = container.href_to_name(link.get('href'), name)
|
sname = container.href_to_name(link.get('href'), name)
|
||||||
if sname in sheets:
|
if sname not in sheets:
|
||||||
style_rules[sname] = tuple(filter_used_rules(root, style_rules[sname], container.log, pseudo_pat, cache))
|
continue
|
||||||
|
style_rules[sname] = tuple(filter_used_rules(root, style_rules[sname], container.log, pseudo_pat, cache))
|
||||||
if remove_unused_classes:
|
if remove_unused_classes:
|
||||||
used_classes |= class_map[sname]
|
used_classes |= class_map[sname]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user