weblate/scripts/extract-release-notes
Michal Čihař b12f50cf99 scripts: Use HTML as source for GitHub release notes
Using rendered HTML makes all links to the documentation work.

Issue #9910
2023-09-11 12:19:25 +02:00

21 lines
490 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>(.+?)</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[1])