diff --git a/extra/release.py b/extra/release.py index 5a4baf423..239d81361 100755 --- a/extra/release.py +++ b/extra/release.py @@ -26,12 +26,15 @@ RST_LATEST_CHANGES = re.compile( ) Replacement: TypeAlias = "tuple[str, str | Callable[[re.Match[str]], str]]" RST_REPLACEMENTS: list[Replacement] = [ + (r"(?<=\n) {3,4}(?=\*)", " "), # fix indent of nested bullet points ... + (r"(?<=\n) {5,6}(?=[\w:`])", " "), # ... and align wrapped text indent (r"(?<=[\s(])`([^`]+)`(?=[^_])", r"``\1``"), # ticks with verbatim ranges. (r":bug:`(\d+)`", r":bug: (#\1)"), # Issue numbers. (r":user:`(\w+)`", r"@\1"), # Users. ] MD_REPLACEMENTS: list[Replacement] = [ - (r"^ ( *- )", r"\1"), # remove list indentation + (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"^- `/?plugins/(\w+)`:?", r"- Plugin **`\1`**:"), # highlight plugins (r"^- `(\w+)-cmd`:?", r"- Command **`\1`**:"), # highlight commands diff --git a/test/test_release.py b/test/test_release.py index c16aa43f2..9f40fc934 100644 --- a/test/test_release.py +++ b/test/test_release.py @@ -65,19 +65,14 @@ def md_changelog(): ### Bug fixes -- Some fix that refers to an issue. :bug: (\#5467) - -- Some fix that mentions user @username. - -- - Some fix with its own bullet points using incorrect indentation: - - - First nested bullet point with some text that wraps to the next line - - Second nested bullet point - - Another fix with its own bullet points using correct indentation: - - - First - - Second + - First + - Second +- Some fix that mentions user @username. +- Some fix that refers to an issue. :bug: (\#5467) +- Some fix with its own bullet points using incorrect indentation: + - First nested bullet point with some text that wraps to the next line + - Second nested bullet point ### Other changes