Fixes to urls

This commit is contained in:
Griatch 2020-07-08 21:51:14 +02:00
parent 21cb3f69c8
commit 3b87cffed6
7 changed files with 57 additions and 12 deletions

View file

@ -18,6 +18,14 @@ _TOC_FILE = pathjoin(_SOURCE_DIR, "toc.md")
_NO_REMAP_STARTSWITH = ["http://", "https://", "github:", "api:",
"feature-request", "report-bug", "issue", "bug-report"]
TXT_REMAPS = {
"Developer Central": "Evennia Component overview"
}
URL_REMAPS = {
"Developer-Central": "Component/Component-Overview",
}
_CURRFILE = None
def create_toctree():
@ -81,6 +89,9 @@ def create_toctree():
grpdict = match.groupdict()
txt, url = grpdict['txt'], grpdict['url']
txt = TXT_REMAPS.get(txt, txt)
url = URL_REMAPS.get(url, url)
if any(url.startswith(noremap) for noremap in _NO_REMAP_STARTSWITH):
return f"[{txt}]({url})"
@ -103,6 +114,9 @@ def create_toctree():
grpdict = match.groupdict()
txt, url = grpdict['txt'], grpdict['url']
txt = TXT_REMAPS.get(txt, txt)
url = URL_REMAPS.get(url, url)
if any(url.startswith(noremap) for noremap in _NO_REMAP_STARTSWITH):
return f"[{txt}]({url})"