From 336d6a99d599976b2a0a2b93d81e7062b25df4f6 Mon Sep 17 00:00:00 2001 From: Jerome Fellus Date: Fri, 15 Nov 2024 12:21:41 +0100 Subject: [PATCH] fix: fix broken links and anchor warnings --- scripts/fix_absolute_links.py | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 scripts/fix_absolute_links.py diff --git a/scripts/fix_absolute_links.py b/scripts/fix_absolute_links.py deleted file mode 100644 index 061d698ba..000000000 --- a/scripts/fix_absolute_links.py +++ /dev/null @@ -1,20 +0,0 @@ -import logging -import re -from subprocess import PIPE, STDOUT, Popen - - -p = Popen(["mkdocs", "build"], stdout=PIPE, stderr=STDOUT, text=True) -for line in p.stdout: # type: ignore - m = re.match( - r"INFO.*Doc file '(.*)' contains an absolute link '(.*)', it was left as is. Did you mean '(.*)'\s*?", - line, - ) - if m: - src, href, fix = m.groups() - src = "docs/" + src - logging.info(f"Replace {href} -> {fix} in {src}") - with open(src) as f: - content = f.read() - content = content.replace(f"({href})", f"({fix})") - with open(src, "w") as f: - f.write(content)