mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
make :any: role work with intersphinx!
This commit is contained in:
parent
e1169d0937
commit
a973daea41
@ -83,7 +83,7 @@ texinfo_documents = [
|
||||
|
||||
# We're not using intersphinx right now, but if we did, this would be part of
|
||||
# the mapping:
|
||||
intersphinx_mapping = {'python': ('http://docs.python.org/dev', None)}
|
||||
intersphinx_mapping = {'python': ('http://docs.python.org/2/', None)}
|
||||
|
||||
# Sphinx document translation with sphinx gettext feature uses these settings:
|
||||
locale_dirs = ['locale/']
|
||||
|
@ -86,6 +86,10 @@ Cross-referencing anything
|
||||
Python module (usually ``:py:mod:`signal``` or ``:mod:`signal```) and a
|
||||
section (usually ``:ref:`about-signals```).
|
||||
|
||||
The :rst:role:`any` role also works together with the
|
||||
:mod:`~sphinx.ext.intersphinx` extension: when no local cross-reference is
|
||||
found, all object types of intersphinx inventories are also searched.
|
||||
|
||||
|
||||
Cross-referencing objects
|
||||
-------------------------
|
||||
|
@ -222,11 +222,17 @@ def load_mappings(app):
|
||||
|
||||
def missing_reference(app, env, node, contnode):
|
||||
"""Attempt to resolve a missing reference via intersphinx references."""
|
||||
target = node['reftarget']
|
||||
if node['reftype'] == 'any':
|
||||
# we search anything!
|
||||
objtypes = ['%s:%s' % (domain.name, objtype)
|
||||
for domain in env.domains.values()
|
||||
for objtype in domain.object_types]
|
||||
else:
|
||||
domain = node.get('refdomain')
|
||||
if not domain:
|
||||
# only objects in domains are in the inventory
|
||||
return
|
||||
target = node['reftarget']
|
||||
objtypes = env.domains[domain].objtypes_for_role(node['reftype'])
|
||||
if not objtypes:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user