weblate/scripts/extract-release-notes.py
Michal Čihař f8846e258a chore: fix linting error
Fix or override issues found by linters.
2025-11-25 16:42:44 +01:00

25 lines
630 B
Python
Executable file

#!/usr/bin/env python3
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
import re
import sys
from pathlib import Path
RUBRIC_RE = re.compile(r'<p class="rubric">([^<\n]*)</p>')
version = '[^"]*'
if len(sys.argv) == 2:
version = sys.argv[1].replace(".", "-")
tag = f'<section id="weblate-{version}">.+?<h1>(.+?)<a(.+?)</a></h1>(.+?)</section>'
data = Path("docs/_build/html/changes.html").read_text(encoding="utf-8")
for match in re.findall(tag, data, re.MULTILINE | re.DOTALL):
print(match[0])
print()
print(RUBRIC_RE.sub(r"<h3>\1</h3>", match[2]))
break