Fix handling of @import rules in the report

This commit is contained in:
Kovid Goyal 2015-01-22 22:12:32 +05:30
parent 5f35a590d8
commit 0096c8eae2

View File

@ -167,10 +167,11 @@ def css_data(container, book_locale):
for rule in sheet: for rule in sheet:
if isinstance(rule, CSSRule): if isinstance(rule, CSSRule):
yield rule yield rule
sheet = importable_sheets.get(rule) else: # @import rule
if sheet is not None: isheet = importable_sheets.get(rule)
for rule in rules_in_sheet(sheet): if isheet is not None:
yield rule for irule in rules_in_sheet(isheet):
yield irule
def sheets_for_html(name, root): def sheets_for_html(name, root):
for href in link_path(root): for href in link_path(root):
@ -212,7 +213,7 @@ def css_data(container, book_locale):
for name, inline_sheets in html_sheets.iteritems(): for name, inline_sheets in html_sheets.iteritems():
root = container.parsed(name) root = container.parsed(name)
for sheet in list(sheets_for_html(name, root)) + inline_sheets: for sheet in list(sheets_for_html(name, root)) + inline_sheets:
for rule in sheet: for rule in rules_in_sheet(sheet):
rule_map[rule][name].extend(matches_for_selector(rule.selector, root)) rule_map[rule][name].extend(matches_for_selector(rule.selector, root))
ans = [] ans = []