mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
* Allow the ~ prefix on module xrefs.
* The parse function for custom descitems must return the full name for x-refing.
This commit is contained in:
parent
dd14145ed5
commit
d8c601b4cd
@ -321,18 +321,20 @@ def desc_directive(desctype, arguments, options, content, lineno,
|
||||
# another registered generic x-ref directive
|
||||
rolename, indextext, parse_node = additional_xref_types[desctype]
|
||||
if parse_node:
|
||||
parse_node(sig, signode)
|
||||
fullname = parse_node(sig, signode)
|
||||
else:
|
||||
signode.clear()
|
||||
signode += addnodes.desc_name(sig, sig)
|
||||
fullname = sig
|
||||
if not noindex:
|
||||
targetname = '%s-%s' % (rolename, sig)
|
||||
targetname = '%s-%s' % (rolename, fullname)
|
||||
signode['ids'].append(targetname)
|
||||
state.document.note_explicit_target(signode)
|
||||
if indextext:
|
||||
env.note_index_entry('pair', '%s; %s' % (indextext, sig),
|
||||
env.note_index_entry('pair',
|
||||
'%s; %s' % (indextext, fullname),
|
||||
targetname, targetname)
|
||||
env.note_reftarget(rolename, sig, targetname)
|
||||
env.note_reftarget(rolename, fullname, targetname)
|
||||
# don't use object indexing below
|
||||
continue
|
||||
except ValueError, err:
|
||||
|
@ -120,8 +120,9 @@ def xfileref_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||
# we want a cross-reference, create the reference node
|
||||
pnode = addnodes.pending_xref(rawtext, reftype=typ, refcaption=False,
|
||||
modname=env.currmodule, classname=env.currclass)
|
||||
innertext = text
|
||||
# special actions for Python object cross-references
|
||||
if typ in ('data', 'exc', 'func', 'class', 'const', 'attr', 'meth'):
|
||||
if typ in ('data', 'exc', 'func', 'class', 'const', 'attr', 'meth', 'mod'):
|
||||
# if the first character is a dot, search more specific namespaces first
|
||||
# else search builtins first
|
||||
if text[0:1] == '.':
|
||||
@ -134,7 +135,6 @@ def xfileref_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||
dot = text.rfind('.')
|
||||
if dot != -1:
|
||||
innertext = text[dot+1:]
|
||||
innertext = text
|
||||
# look if explicit title and target are given
|
||||
brace = text.find('<')
|
||||
if brace != -1:
|
||||
|
Loading…
Reference in New Issue
Block a user