Created
February 9, 2014 10:36
-
-
Save adiroiban/8897350 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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