Skip to content

Commit

Permalink
fix(docs): GitHub releases had 404's for :ref: links.
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed May 23, 2022
1 parent ab520ed commit 0aa1070
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ci/parse_relnotes.py
Expand Up @@ -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.
Expand All @@ -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,
Expand Down

0 comments on commit 0aa1070

Please sign in to comment.