From 3a1e3c7feb4ea0c92c8c081a5ff88ce6a59c94db Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Sun, 19 Apr 2015 14:37:50 +0200 Subject: [PATCH] Account for anchorlinks inside the same document --- docs/transform_github_links.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/transform_github_links.py b/docs/transform_github_links.py index 2bded08..e136eda 100644 --- a/docs/transform_github_links.py +++ b/docs/transform_github_links.py @@ -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))