Another fix to auto-relinker
This commit is contained in:
parent
fab769e0d0
commit
f2d460672e
1 changed files with 26 additions and 18 deletions
|
|
@ -46,10 +46,14 @@ def create_toctree():
|
|||
def _sub(match):
|
||||
grpdict = match.groupdict()
|
||||
txt, url = grpdict['txt'], grpdict['url']
|
||||
|
||||
if "http" in url and "://" in url:
|
||||
urlout = url
|
||||
else:
|
||||
fname, *part = url.rsplit("/", 1)
|
||||
fname = part[0] if part else fname
|
||||
fname = fname.rsplit(".", 1)[0]
|
||||
fname, *anchor = url.rsplit("#", 1)
|
||||
fname, *anchor = fname.rsplit("#", 1)
|
||||
if fname in docref_map:
|
||||
urlout = docref_map[fname] + ('#' + anchor[0] if anchor else '')
|
||||
if urlout != url:
|
||||
|
|
@ -61,10 +65,14 @@ def create_toctree():
|
|||
def _sub_doc(match):
|
||||
grpdict = match.groupdict()
|
||||
txt, url = grpdict['txt'], grpdict['url']
|
||||
|
||||
if "http" in url and "://" in url:
|
||||
urlout = url
|
||||
else:
|
||||
fname, *part = url.rsplit("/", 1)
|
||||
fname = part[0] if part else fname
|
||||
fname = fname.rsplit(".", 1)[0]
|
||||
fname, *anchor = url.rsplit("#", 1)
|
||||
fname, *anchor = fname.rsplit("#", 1)
|
||||
if fname in docref_map:
|
||||
urlout = docref_map[fname] + ('#' + anchor[0] if anchor else '')
|
||||
if urlout != url:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue