javadoc.py
Go to the documentation of this file.
00001 # Copyright (C) 2012 Google Inc.
00002 #
00003 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
00004 # use this file except in compliance with the License. You may obtain a copy of
00005 # the License at
00006 #
00007 # http://www.apache.org/licenses/LICENSE-2.0
00008 #
00009 # Unless required by applicable law or agreed to in writing, software
00010 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00011 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
00012 # License for the specific language governing permissions and limitations under
00013 # the License.
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 


android_core
Author(s): Damon Kohler
autogenerated on Thu Jun 6 2019 21:20:07