From f74624ab864e8322f01d3162e8982019d7e4fa0b Mon Sep 17 00:00:00 2001 From: Andrea Giudiceandrea Date: Fri, 16 Aug 2024 09:48:38 +0200 Subject: [PATCH] Fix earlier versions' links in make_api_rst.py (#150) * Fix earlier versions' links in make_api_rst.py * Update scripts/make_api_rst.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Denis Rouzaud Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- scripts/make_api_rst.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/make_api_rst.py b/scripts/make_api_rst.py index 45a7863b55e1..b9306681ca85 100755 --- a/scripts/make_api_rst.py +++ b/scripts/make_api_rst.py @@ -62,14 +62,14 @@ def ltr_tag(v): current_stable = cfg["current_stable"] current_ltr = cfg["current_ltr"] -current_stable_minor = int(current_stable.split(".")[1]) + 2 # '3.38' => 40 -current_ltr_minor = int(current_ltr.split(".")[1]) + 2 # '3.38' => 40 +current_stable_minor = int(current_stable.split(".")[1]) +current_ltr_minor = int(current_ltr.split(".")[1]) old_versions_links = ", ".join( reversed( [ f"`3.{v} `_" for v in range(0, current_stable_minor, 2) - if v not in (current_stable_minor, current_ltr_minor) + if v != current_ltr_minor ] ) ) @@ -78,7 +78,6 @@ def ltr_tag(v): r"""^(?:([\w.]+::)?([\w.]+\.)?(\w+)\s*(?:\((.*)\)(?:\s*->\s*([\w.]+(?:\[.*?\])?))?(?:\s*\[(signal)\])?)?)?$""" ) - # Make sure :numbered: is only specified in the top level index - see # sphinx docs about this. document_header = f"""