mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Fix ordering bullet point lists
This commit is contained in:
parent
7b9625bc86
commit
d98226aa07
2 changed files with 9 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ from __future__ import annotations
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
from functools import partial
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
|
|
@ -19,7 +20,6 @@ BASE = Path(__file__).parent.parent.absolute()
|
||||||
PYPROJECT = BASE / "pyproject.toml"
|
PYPROJECT = BASE / "pyproject.toml"
|
||||||
CHANGELOG = BASE / "docs" / "changelog.rst"
|
CHANGELOG = BASE / "docs" / "changelog.rst"
|
||||||
|
|
||||||
MD_CHANGELOG_SECTION_LIST = re.compile(r"- .+?(?=\n\n###|$)", re.DOTALL)
|
|
||||||
version_header = r"\d+\.\d+\.\d+ \([^)]+\)"
|
version_header = r"\d+\.\d+\.\d+ \([^)]+\)"
|
||||||
RST_LATEST_CHANGES = re.compile(
|
RST_LATEST_CHANGES = re.compile(
|
||||||
rf"{version_header}\n--+\s+(.+?)\n\n+{version_header}", re.DOTALL
|
rf"{version_header}\n--+\s+(.+?)\n\n+{version_header}", re.DOTALL
|
||||||
|
|
@ -37,6 +37,10 @@ MD_REPLACEMENTS: list[Replacement] = [
|
||||||
(r"^- `(\w+)-cmd`:?", r"- Command **`\1`**:"), # highlight commands
|
(r"^- `(\w+)-cmd`:?", r"- Command **`\1`**:"), # highlight commands
|
||||||
(r"### [^\n]+\n+(?=### )", ""), # remove empty sections
|
(r"### [^\n]+\n+(?=### )", ""), # remove empty sections
|
||||||
]
|
]
|
||||||
|
order_bullet_points = partial(
|
||||||
|
re.compile("(\n- .*?(?=\n(?! *- )|$))", flags=re.DOTALL).sub,
|
||||||
|
lambda m: "\n- ".join(sorted(m.group().split("\n- "))),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def update_docs_config(text: str, new: Version) -> str:
|
def update_docs_config(text: str, new: Version) -> str:
|
||||||
|
|
@ -136,10 +140,9 @@ def changelog_as_markdown(rst: str) -> str:
|
||||||
for pattern, repl in MD_REPLACEMENTS:
|
for pattern, repl in MD_REPLACEMENTS:
|
||||||
md = re.sub(pattern, repl, md, flags=re.M)
|
md = re.sub(pattern, repl, md, flags=re.M)
|
||||||
|
|
||||||
# sort list items alphabetically for each of the sections
|
# order bullet points in each of the lists alphabetically to
|
||||||
return MD_CHANGELOG_SECTION_LIST.sub(
|
# improve readability
|
||||||
lambda m: "\n".join(sorted(m.group().splitlines())), md
|
return order_bullet_points(md)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,9 @@ def md_changelog():
|
||||||
|
|
||||||
### Other changes
|
### Other changes
|
||||||
|
|
||||||
|
- Changed `bitesize` label to `good first issue`. Our [contribute](https://github.com/beetbox/beets/contribute) page is now automatically populated with these issues. :bug: (\#4855)
|
||||||
|
|
||||||
# 2.1.0 (November 22, 2024)
|
# 2.1.0 (November 22, 2024)
|
||||||
- Changed `bitesize` label to `good first issue`. Our [contribute](https://github.com/beetbox/beets/contribute) page is now automatically populated with these issues. :bug: (\#4855)
|
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue