diff --git a/scripts/create-release b/scripts/create-release
index 1d74c6c033e0..f6e7f820efe6 100755
--- a/scripts/create-release
+++ b/scripts/create-release
@@ -22,6 +22,9 @@ if [ "$1" = "--tag" ] ; then
shift
fi
+# Build the documentation (for release notes)
+make -C docs html
+
# Start with clean build environment
./setup.py clean
find weblate/locale/ docs/locales/ -name '*.mo' -delete
@@ -82,8 +85,10 @@ if [ "$DO_TAG" -eq 1 ] ; then
git checkout main
# Convert release notes to markdown
- ./scripts/extract-release-notes "$version" > "dist/Weblate-$version.rst"
- pandoc "dist/Weblate-$version.rst" --write=gfm --wrap=none -o "dist/Weblate-$version.md"
+ sed "s/latest/$namever/" < scripts/release-notes-filter.lua > scripts/release-notes-filter.version.lua
+ ./scripts/extract-release-notes "$version" > "dist/Weblate-$version.html"
+ pandoc "dist/Weblate-$version.html" --write=gfm --wrap=none --lua-filter=scripts/release-notes-filter.version.lua -o "dist/Weblate-$version.md"
+ rm scripts/release-notes-filter.version.lua
# Upload to GitHub
sleep 10
diff --git a/scripts/extract-release-notes b/scripts/extract-release-notes
index 1a3750138b20..a59b37b8e341 100755
--- a/scripts/extract-release-notes
+++ b/scripts/extract-release-notes
@@ -4,21 +4,18 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
+import re
import sys
if len(sys.argv) != 2:
- raise ValueError("Missing argument")
+ raise ValueError("Missing version argument")
-start = f"Weblate {sys.argv[1]}\n"
-display = False
+tag = ''.format(
+ sys.argv[1].replace(".", "-")
+)
-with open("docs/changes.rst") as handle:
- for line in handle:
- if display:
- if line.startswith("Weblate "):
- break
- elif not line.startswith("--"):
- print(line, end="")
- elif line == start:
- display = True
- print(line, end="")
+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])
diff --git a/scripts/release-notes-filter.lua b/scripts/release-notes-filter.lua
new file mode 100644
index 000000000000..1749a5e9b4ae
--- /dev/null
+++ b/scripts/release-notes-filter.lua
@@ -0,0 +1,16 @@
+-- Copyright © Michal Čihař
+--
+-- SPDX-License-Identifier: GPL-3.0-or-later
+
+function fix_link (url)
+ return url:sub(1,4) == "http" and url or "https://docs.weblate.org/en/latest/" .. url
+end
+function Link (link)
+ link.target = fix_link(link.target);
+ return link
+end
+function Image (img)
+ img.src = fix_link(img.src);
+ return src
+end
+return {{Link = Link, Image = Image}}