This commit is contained in:
Kovid Goyal 2015-01-22 22:14:47 +05:30
parent 0096c8eae2
commit f83b1a5720

View File

@ -8,6 +8,7 @@ __copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import posixpath, os, time, types, re import posixpath, os, time, types, re
from collections import namedtuple, defaultdict, Counter from collections import namedtuple, defaultdict, Counter
from itertools import chain
from calibre import prepare_string_for_xml, force_unicode from calibre import prepare_string_for_xml, force_unicode
from calibre.ebooks.oeb.base import XPath from calibre.ebooks.oeb.base import XPath
@ -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 chain(sheets_for_html(name, root), inline_sheets):
for rule in rules_in_sheet(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))