Fix nested bullet points conversion

This commit is contained in:
Šarūnas Nejus 2024-12-04 02:02:20 +00:00
parent dd96928f38
commit c26473e6cb
No known key found for this signature in database
GPG key ID: DD28F6704DBE3435
2 changed files with 11 additions and 13 deletions

View file

@ -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

View file

@ -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
- 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