mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-10-15 13:22:06 +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 = []
|
||||
|
||||
skip = False
|
||||
section: Union[SectionType, Dict] = {}
|
||||
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("## "):
|
||||
pass
|
||||
skip = True
|
||||
continue
|
||||
|
||||
# Beginning of new section
|
||||
if line.startswith("### "):
|
||||
skip = False
|
||||
# Save the previous section
|
||||
if section:
|
||||
sections.append(section)
|
||||
_section: SectionType = {
|
||||
|
||||
# Start a new section
|
||||
section: SectionType = {
|
||||
"title": line.strip("# "),
|
||||
"items": [],
|
||||
}
|
||||
section = _section
|
||||
continue
|
||||
|
||||
m = ITEM_PATTERN.match(line)
|
||||
if m:
|
||||
gd = m.groupdict()
|
||||
# If skip is enabled, skip the line
|
||||
if skip:
|
||||
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)
|
||||
continue
|
||||
|
||||
# Save the last section
|
||||
sections.append(section)
|
||||
|
||||
first = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue