Account for anchorlinks inside the same document

This commit is contained in:
Anders Ingemann 2015-04-19 14:37:50 +02:00
parent 8064cddb1d
commit 3a1e3c7feb

View file

@ -93,4 +93,8 @@ def transform_github_links(app, doctree, fromdocname):
docs_link = find_docs_link(abs_link)
if docs_link is None:
continue
node['refuri'] = os.path.relpath(docs_link, os.path.dirname(fromdocname))
# special handling for when we link inside the same document
if docs_link.startswith('#'):
node['refuri'] = docs_link
else:
node['refuri'] = os.path.relpath(docs_link, os.path.dirname(fromdocname))