You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
css for named page with pseudo-class, e.g. @page mypage:left throws error Unsupported @page selector.
To prevent this and make pseudo-class work I altered the function preprocess_stylesheet() in weasyprint/css/__init__.py. Inserted the following code at line 680:
# 19.1.2017: implement named page with pseudo-class
# @page <name>:<left|right|blank|first>
elif (len(tokens) == 3 and
tokens[0].type == 'ident' and
tokens[1].type == 'literal' and
tokens[1].value == ':' and
tokens[2].type == 'ident'):
pseudo_class = tokens[2].lower_value
if pseudo_class in ('left', 'right'):
types['side'] = pseudo_class
specificity = (0, 0, 1)
elif pseudo_class in ('blank', 'first'):
types[pseudo_class] = True
specificity = (0, 1, 0)
else:
LOGGER.warning('Unknown @page pseudo-class "%s", '
'the whole @page rule was ignored '
'at %s:%s.',
pseudo_class,
rule.source_line, rule.source_column)
continue
# page-name
types['name'] = tokens[0].value
The text was updated successfully, but these errors were encountered:
css for named page with pseudo-class, e.g.
@page mypage:left
throws errorUnsupported @page selector
.To prevent this and make pseudo-class work I altered the function
preprocess_stylesheet()
inweasyprint/css/__init__.py
. Inserted the following code at line 680:The text was updated successfully, but these errors were encountered: