summaryrefslogtreecommitdiff
path: root/tests/root/conf.py
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2012-03-11 17:48:51 +0100
committerPauli Virtanen <pav@iki.fi>2012-03-11 17:48:51 +0100
commite85f2467852ec4d42e4f4ed147bd64ef2907517d (patch)
tree5c2fc418a1845dd24722b1e5917a35b45ea52bb0 /tests/root/conf.py
parent3137157ebafefaedad02cfc780957b3adb59e826 (diff)
downloadsphinx-e85f2467852ec4d42e4f4ed147bd64ef2907517d.tar.gz
ENH: add a linkcode extension
Diffstat (limited to 'tests/root/conf.py')
-rw-r--r--tests/root/conf.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/root/conf.py b/tests/root/conf.py
index b97ddfcc..37d5e91a 100644
--- a/tests/root/conf.py
+++ b/tests/root/conf.py
@@ -67,6 +67,28 @@ extlinks = {'issue': ('http://bugs.python.org/issue%s', 'issue '),
# modify tags from conf.py
tags.add('confpytag')
+# -- linkcode
+
+if 'test_linkcode' in tags:
+ import glob
+
+ extensions.remove('sphinx.ext.viewcode')
+ extensions.append('sphinx.ext.linkcode')
+
+ exclude_patterns.extend(glob.glob('*.txt') + glob.glob('*/*.txt'))
+ exclude_patterns.remove('contents.txt')
+ exclude_patterns.remove('objects.txt')
+
+ def linkcode_resolve(domain, info):
+ if domain == 'py':
+ fn = info['module'].replace('.', '/')
+ return "http://foobar/source/%s.py" % fn
+ elif domain == "js":
+ return "http://foobar/js/" + info['fullname']
+ elif domain in ("c", "cpp"):
+ return "http://foobar/%s/%s" % (domain, "".join(info['names']))
+ else:
+ raise AssertionError()
# -- extension API