mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merged in pv/sphinx-work/ext-linkcode (pull request #47)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user