mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #7183: intersphinx: `:attr:` reference to property is broken
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -18,6 +18,7 @@ Bugs fixed
|
||||
|
||||
* #7184: autodoc: ``*args`` and ``**kwarg`` in type comments are not handled
|
||||
properly
|
||||
* #7183: intersphinx: ``:attr:`` reference to property is broken
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
||||
@@ -282,6 +282,9 @@ def missing_reference(app: Sphinx, env: BuildEnvironment, node: Element, contnod
|
||||
if 'std:cmdoption' in objtypes:
|
||||
# until Sphinx-1.6, cmdoptions are stored as std:option
|
||||
objtypes.append('std:option')
|
||||
if 'py:attribute' in objtypes:
|
||||
# Since Sphinx-2.1, properties are stored as py:method
|
||||
objtypes.append('py:method')
|
||||
to_try = [(inventories.main_inventory, target)]
|
||||
if domain:
|
||||
full_qualified_name = env.get_domain(domain).get_full_qualified_name(node)
|
||||
|
||||
@@ -190,6 +190,12 @@ def test_missing_reference_pydomain(tempdir, app, status, warning):
|
||||
rn = missing_reference(app, app.env, node, contnode)
|
||||
assert rn.astext() == 'func()'
|
||||
|
||||
# py:attr context helps to search objects
|
||||
kwargs = {'py:module': 'module1'}
|
||||
node, contnode = fake_node('py', 'attr', 'Foo.bar', 'Foo.bar', **kwargs)
|
||||
rn = missing_reference(app, app.env, node, contnode)
|
||||
assert rn.astext() == 'Foo.bar'
|
||||
|
||||
|
||||
def test_missing_reference_stddomain(tempdir, app, status, warning):
|
||||
inv_file = tempdir / 'inventory'
|
||||
|
||||
@@ -31,6 +31,7 @@ inventory_v2 = '''\
|
||||
module1 py:module 0 foo.html#module-module1 Long Module desc
|
||||
module2 py:module 0 foo.html#module-$ -
|
||||
module1.func py:function 1 sub/foo.html#$ -
|
||||
module1.Foo.bar py:method 1 index.html#foo.Bar.baz -
|
||||
CFunc c:function 2 cfunc.html#CFunc -
|
||||
std cpp:type 1 index.html#std -
|
||||
std::uint8_t cpp:type 1 index.html#std_uint8_t -
|
||||
|
||||
Reference in New Issue
Block a user