Skip to content

Commit b6024b9

Browse files
committed
Add ! x-ref feature.
1 parent ac90866 commit b6024b9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎sphinx/roles.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ def xfileref_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
9999
if typ in ('func', 'meth', 'cfunc') and \
100100
env.config.get('add_function_parentheses', True):
101101
text += '()'
102+
# if the first character is a bang, don't cross-reference at all
103+
if text[0:1] == '!':
104+
text = text[1:]
105+
return [innernodetypes.get(typ, nodes.literal)(
106+
rawtext, text, classes=['xref'])], []
102107
pnode = addnodes.pending_xref(rawtext)
103108
pnode['reftype'] = typ
104109
# if the first character is a dot, search more specific namespaces first

0 commit comments

Comments
 (0)