From b302bc6df2297c9c79e9f7c420561abfee599a20 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Mon, 9 Sep 2024 10:01:09 +0200 Subject: [PATCH] Update mdit_py_plugins/attrs/index.py --- mdit_py_plugins/attrs/index.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mdit_py_plugins/attrs/index.py b/mdit_py_plugins/attrs/index.py index 80e9141..2586c80 100644 --- a/mdit_py_plugins/attrs/index.py +++ b/mdit_py_plugins/attrs/index.py @@ -61,11 +61,11 @@ def _attr_inline_rule(state: StateInline, silent: bool) -> bool: return False try: new_pos, attrs = parse(state.src[state.pos :]) - if allowed_attributes is not None: - attrs = {k: v for k, v in attrs.items() if k in allowed_attributes} - token.meta["insecure_attrs"] = { + if allowed_attributes is not None and (disallowed := { k: v for k, v in attrs.items() if k not in allowed_attributes - } + }): + token.meta["insecure_attrs"] = dissalowed + attrs = {k: v for k, v in attrs.items() if k in allowed_attributes} except ParseError: return False token_index = _find_opening(state.tokens, len(state.tokens) - 1)