summaryrefslogtreecommitdiff
path: root/ci/parse_relnotes.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-05-23 19:51:09 -0400
committerNed Batchelder <ned@nedbatchelder.com>2022-05-23 19:51:09 -0400
commit0aa1070a2c9a99e10b7790b9a6a40a631ba5514e (patch)
treee9b8e631d9790787a4fa1f8a3bcc21586ab233be /ci/parse_relnotes.py
parentab520ed097bbfc1dd1b8bf911e753ebfc3a4ff38 (diff)
downloadpython-coveragepy-git-0aa1070a2c9a99e10b7790b9a6a40a631ba5514e.tar.gz
fix(docs): GitHub releases had 404's for :ref: links.
Diffstat (limited to 'ci/parse_relnotes.py')
-rw-r--r--ci/parse_relnotes.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ci/parse_relnotes.py b/ci/parse_relnotes.py
index d19e6d60..ba5089eb 100644
--- a/ci/parse_relnotes.py
+++ b/ci/parse_relnotes.py
@@ -84,6 +84,14 @@ def refind(regex, text):
else:
return None
+
+def fix_ref_links(text, version):
+ """Find links to .rst files, and make them full RTFD links."""
+ def new_link(m):
+ return f"](https://coverage.readthedocs.io/en/{version}/{m[1]}.html{m[2]})"
+ return re.sub(r"\]\((\w+)\.rst(#.*?)\)", new_link, text)
+
+
def relnotes(mdlines):
r"""Yield (version, text) pairs from markdown lines.
@@ -97,6 +105,7 @@ def relnotes(mdlines):
if version:
prerelease = any(c in version for c in "abc")
when = refind(r"\d+-\d+-\d+", htext)
+ text = fix_ref_links(text, version)
yield {
"version": version,
"text": text,