mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Micro-optimization
This commit is contained in:
parent
d2eb1426b0
commit
1255f81cfd
@ -122,11 +122,11 @@ def iterlinks(root, find_links_in_css=True):
|
|||||||
for el in root.iter():
|
for el in root.iter():
|
||||||
attribs = el.attrib
|
attribs = el.attrib
|
||||||
try:
|
try:
|
||||||
tag = el.tag
|
tag = barename(el.tag).lower()
|
||||||
except UnicodeDecodeError:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if tag == XHTML('object'):
|
if tag == 'object':
|
||||||
codebase = None
|
codebase = None
|
||||||
# <object> tags have attributes that are relative to
|
# <object> tags have attributes that are relative to
|
||||||
# codebase
|
# codebase
|
||||||
@ -152,7 +152,7 @@ def iterlinks(root, find_links_in_css=True):
|
|||||||
|
|
||||||
if not find_links_in_css:
|
if not find_links_in_css:
|
||||||
continue
|
continue
|
||||||
if tag == XHTML('style') and el.text:
|
if tag == 'style' and el.text:
|
||||||
for match in _css_url_re.finditer(el.text):
|
for match in _css_url_re.finditer(el.text):
|
||||||
yield (el, None, match.group(1), match.start(1))
|
yield (el, None, match.group(1), match.start(1))
|
||||||
for match in _css_import_re.finditer(el.text):
|
for match in _css_import_re.finditer(el.text):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user