weblate/scripts/extract-release-notes
2023-11-16 17:08:22 +01:00

23 lines
533 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
if len(sys.argv) != 2:
raise ValueError("Missing version argument")
tag = '<section id="weblate-{}">.+?<h1>(.+?)<a(.+?)</a></h1>(.+?)</section>'.format(
sys.argv[1].replace(".", "-")
)
with open("docs/_build/html/changes.html") as handle:
data = handle.read()
for match in re.findall(tag, data, re.MULTILINE | re.DOTALL):
print(match[0])
print()
print(match[2])