Skip to content

Instantly share code, notes, and snippets.

@adiroiban adiroiban/bla.diff
Created Feb 9, 2014

Embed
What would you like to do?
diff --git a/docs/_extensions/apilinks.py b/docs/_extensions/apilinks.py
index 656d350..7b939fb 100644
--- a/docs/_extensions/apilinks.py
+++ b/docs/_extensions/apilinks.py
@@ -23,15 +23,21 @@ def make_api_link(name, rawtext, text, lineno, inliner,
full_name = full_name.strip()
label = label.strip('>').strip()
else:
- full_name = label = text
+ full_name = text
+
+ anchor = ''
+ if '#' in full_name:
+ full_name, anchor = full_name.split('#', 1)
+ # Add back the hash.
+ anchor = '#' + anchor
#get the base url for api links from the config file
env = inliner.document.settings.env
- base_url = env.config.apilinks_base_url
+ base_url = env.config.apilinks_base_url
# not really sufficient, but just testing...
# ...hmmm, maybe this is good enough after all
- ref = ''.join((base_url, full_name, '.html'))
+ ref = ''.join((base_url, full_name, '.html', anchor))
node = nodes.reference(rawtext, utils.unescape(label), refuri=ref,
**options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.