We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0e3129d commit 0fcc7deCopy full SHA for 0fcc7de
weasyprint/svg/css.py
@@ -5,6 +5,7 @@
5
import cssselect2
6
import tinycss2
7
8
+from ..logger import LOGGER
9
from .utils import parse_url
10
11
@@ -72,7 +73,13 @@ def parse_stylesheets(tree, url):
72
73
for rule in find_stylesheets_rules(tree, stylesheet, url):
74
normal_declarations, important_declarations = parse_declarations(
75
rule.content)
- for selector in cssselect2.compile_selector_list(rule.prelude):
76
+ try:
77
+ selectors = cssselect2.compile_selector_list(rule.prelude)
78
+ except cssselect2.parser.SelectorError as exception:
79
+ LOGGER.warning(
80
+ 'Failed to apply CSS rule in SVG rule: %s', exception)
81
+ break
82
+ for selector in selectors:
83
if (selector.pseudo_element is None and
84
not selector.never_matches):
85
if normal_declarations:
0 commit comments