From 0b905e1b1714026a217c766e5649df71182d2393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Wed, 4 Dec 2024 04:16:33 +0000 Subject: [PATCH] Ignore literal code blocks when making headers --- extra/release.py | 4 ++-- test/test_release.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extra/release.py b/extra/release.py index 658d8abc7..75ba0b7b5 100755 --- a/extra/release.py +++ b/extra/release.py @@ -35,7 +35,7 @@ RST_REPLACEMENTS: list[Replacement] = [ MD_REPLACEMENTS: list[Replacement] = [ (r"^ (- )", r"\1"), # remove indent from top-level bullet points (r"^ +( - )", r"\1"), # adjust nested bullet points indent - (r"^(\w.+?):$", r"### \1"), # make sections headers + (r"^(\w[^\n]+):(?=\n\n[^ ])", r"### \1"), # make sections headers (r"^- `/?plugins/(\w+)`:?", r"- Plugin **`\1`**:"), # highlight plugins (r"^- `(\w+)-cmd`:?", r"- Command **`\1`**:"), # highlight commands (r"### [^\n]+\n+(?=### )", ""), # remove empty sections @@ -142,7 +142,7 @@ def changelog_as_markdown(rst: str) -> str: md = rst2md(rst) for pattern, repl in MD_REPLACEMENTS: - md = re.sub(pattern, repl, md, flags=re.M) + md = re.sub(pattern, repl, md, flags=re.M | re.DOTALL) # order bullet points in each of the lists alphabetically to # improve readability diff --git a/test/test_release.py b/test/test_release.py index d7e1c1b17..f69389d54 100644 --- a/test/test_release.py +++ b/test/test_release.py @@ -69,7 +69,7 @@ def md_changelog(): - Command **`list`**: Update. - Plugin **`substitute`**: Some substitute multi-line change. :bug: (\#5467) -### You can do something with this command:: +You can do something with this command: $ do-something