Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 __author__ = 'damonkohler@google.com (Damon Kohler)'
00016
00017 import os
00018
00019 from docutils import nodes, utils
00020
00021
00022 def make_javadoc_link(name, rawtext, text, lineno, inliner, options={}, content=[]):
00023 env = inliner.document.settings.env
00024 javadoc_root = env.config.javadoc_root
00025 class_part, method_part = (text.split('#', 1) + [''])[:2]
00026 refuri = os.path.join(javadoc_root, '%s.html#%s' % (class_part.replace('.', '/'), method_part))
00027 label = class_part.rsplit('.', 1)[-1]
00028 if method_part:
00029 label += '.' + method_part.split('(')[0]
00030 node = nodes.reference(rawtext, label, refuri=refuri, **options)
00031 return [node], []
00032
00033
00034 def setup(app):
00035 app.add_config_value('javadoc_root', None, 'env')
00036 app.add_role('javadoc', make_javadoc_link)
00037