mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-10-15 05:12:07 +00:00
- Fix changelog parsing
This commit is contained in:
parent
4ae2ffe377
commit
dfd4527152
1 changed files with 26 additions and 6 deletions
32
.github/tools/reformat_changelog.py
vendored
32
.github/tools/reformat_changelog.py
vendored
|
@ -30,24 +30,44 @@ def reformat(item_format: str, output_emoji: bool) -> None:
|
||||||
|
|
||||||
sections = []
|
sections = []
|
||||||
|
|
||||||
|
skip = False
|
||||||
section: Union[SectionType, Dict] = {}
|
section: Union[SectionType, Dict] = {}
|
||||||
for line in data:
|
for line in data:
|
||||||
|
# If the line is not a list item or a header, skip it
|
||||||
|
if not line[0] in ["#", "*", "-", "+"]:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Skip big header
|
||||||
if line.startswith("## "):
|
if line.startswith("## "):
|
||||||
pass
|
skip = True
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Beginning of new section
|
||||||
if line.startswith("### "):
|
if line.startswith("### "):
|
||||||
|
skip = False
|
||||||
|
# Save the previous section
|
||||||
if section:
|
if section:
|
||||||
sections.append(section)
|
sections.append(section)
|
||||||
_section: SectionType = {
|
|
||||||
|
# Start a new section
|
||||||
|
section: SectionType = {
|
||||||
"title": line.strip("# "),
|
"title": line.strip("# "),
|
||||||
"items": [],
|
"items": [],
|
||||||
}
|
}
|
||||||
section = _section
|
continue
|
||||||
|
|
||||||
m = ITEM_PATTERN.match(line)
|
# If skip is enabled, skip the line
|
||||||
if m:
|
if skip:
|
||||||
gd = m.groupdict()
|
continue
|
||||||
|
|
||||||
|
# Line is a list item in the current section
|
||||||
|
item_pattern_match = ITEM_PATTERN.match(line)
|
||||||
|
if item_pattern_match:
|
||||||
|
gd = item_pattern_match.groupdict()
|
||||||
section["items"].append(gd)
|
section["items"].append(gd)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Save the last section
|
||||||
sections.append(section)
|
sections.append(section)
|
||||||
|
|
||||||
first = True
|
first = True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue