From 8db191f9ece2182bd9863270f8c0984f02b299b0 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:17:45 +0100 Subject: [PATCH] Allow matching prefix with curly braces in `CodeExample.prefix_settings()` The SuperFences markdown extensions uses the following format for attributes: `lang-name {.extra-class attr="a"}` See: https://facelessuser.github.io/pymdown-extensions/extensions/superfences/#injecting-classes-ids-and-attributes --- pytest_examples/find_examples.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest_examples/find_examples.py b/pytest_examples/find_examples.py index 9f6523f..123bb8d 100644 --- a/pytest_examples/find_examples.py +++ b/pytest_examples/find_examples.py @@ -76,7 +76,7 @@ def prefix_settings(self) -> dict[str, str]: This works on the format `py foo="bar" spam="with space"`. """ settings = {} - for m in re.finditer(r'(\S+?)=([\'"])(.+?)\2', self.prefix): + for m in re.finditer(r'([^{\s]+?)=([\'"])(.+?)\2', self.prefix): settings[m.group(1)] = m.group(3) return settings