From 87fadc3702f824e3d3ca70bbd58db1754aaf8789 Mon Sep 17 00:00:00 2001 From: Matt Anderson Date: Wed, 16 Aug 2023 16:29:02 -0500 Subject: [PATCH] fix: brace regex --- src/blacken_docs/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blacken_docs/__init__.py b/src/blacken_docs/__init__.py index 62d6c36..4f7c734 100644 --- a/src/blacken_docs/__init__.py +++ b/src/blacken_docs/__init__.py @@ -24,10 +24,10 @@ re.DOTALL | re.MULTILINE, ) PYGMENTS_PY_LANG_CLASSES_RE_FRAGMENT = ( - f"({'|'.join([f'.{lang}' for lang in PYGMENTS_PY_LANGS])})" + "(" + "|".join([r"\." + lang for lang in PYGMENTS_PY_LANGS]) + ")" ) MD_BRACE_RE = re.compile( - r"(?P^(?P *)```\s*\{\s*\." + r"(?P^(?P *)```\s*\{\s*" + PYGMENTS_PY_LANG_CLASSES_RE_FRAGMENT + r"( [^\}\n]*?)?\}\s*?\n)" r"(?P.*?)"