Add `!` x-ref feature.

This commit is contained in:
Georg Brandl 2007-08-17 16:55:09 +00:00
parent ac90866723
commit b6024b9ab7

View File

@ -99,6 +99,11 @@ def xfileref_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
if typ in ('func', 'meth', 'cfunc') and \
env.config.get('add_function_parentheses', True):
text += '()'
# if the first character is a bang, don't cross-reference at all
if text[0:1] == '!':
text = text[1:]
return [innernodetypes.get(typ, nodes.literal)(
rawtext, text, classes=['xref'])], []
pnode = addnodes.pending_xref(rawtext)
pnode['reftype'] = typ
# if the first character is a dot, search more specific namespaces first