From 86202308b68db7a6cf299c5fe3cdee4dc1850330 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 15 Feb 2021 23:55:13 +0000 Subject: Try mapping source: and browser: links This turns out to be less useful than expected, because somehow for every single link in the wiki, the source repository is not quite in the obvios plae with cgit. Might be a cgit configuration issue, but this gets wonky enough that it's probably simpler just to expand the JSON file we already have for the filter rules so that it includes other magic stuff like a URL map for this kind of link. --- trac2md.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'trac2md.py') diff --git a/trac2md.py b/trac2md.py index ab8a558..cf8ecdf 100755 --- a/trac2md.py +++ b/trac2md.py @@ -20,7 +20,7 @@ traclink_pattern = re.compile(r"(?".format(link) elif scheme == "attachment:": mdlink = "[{}]({{attach}}{}/{})".format(text, slug, link) + elif scheme in ("source:", "browser:"): + mdlink = "[{}]({}/{})".format(text, giturl.rstrip("/"), link.lstrip("/")) elif scheme == "wiki:" or (scheme is None and camelcase_pattern.match(link)): mdlink = "[{}]({{filename}}{}.md)".format(text, link) else: @@ -190,7 +197,7 @@ def WikiToMD(content, slug): line = delete_pattern.sub("", line) # Convert wiki links - line = convert_wikilinks(line, slug) + line = convert_wikilinks(line, slug, "https://git.cryptech.is/") # Convert striked through text line = strikethrough_pattern.sub(r"\1", line) -- cgit v1.2.3