Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a global variable 'ignored_message', which is used to expose the … #56

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cssutils/css/cssstyledeclaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"""

__all__ = ['CSSStyleDeclaration', 'Property']

ignored_message=""
import cssutils

from .cssproperties import CSS2Properties
Expand Down Expand Up @@ -322,6 +322,8 @@ def unexpected(expected, seq, token, tokenizer=None):
ignored = self._tokenvalue(token) + self._valuestr(
self._tokensupto2(tokenizer, propertyvalueendonly=True)
)
global ignored_message # Expose ignored messages to the outside, allowing users to retrieve the ignored messages for further processing, such as continuing to parse the ignored content.
ignored_message=ignored
self._log.error(
'CSSStyleDeclaration: Unexpected token, ignoring ' 'upto %r.' % ignored,
token,
Expand Down