mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #5432: py domain: :type: field can't process :term: references
This commit is contained in:
parent
a2748f787c
commit
c0fffb9e8b
1
CHANGES
1
CHANGES
@ -33,6 +33,7 @@ Bugs fixed
|
||||
* #5453: PDF builds of 'howto' documents have no page numbers
|
||||
* #5463: mathbase: math_role and MathDirective was disappeared in 1.8.0
|
||||
* #5454: latex: Index has disappeared from PDF for Japanese documents
|
||||
* #5432: py domain: ``:type:`` field can't process ``:term:`` references
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -305,7 +305,8 @@ class DocFieldTransformer(object):
|
||||
entries.append(field)
|
||||
|
||||
# but if this has a type then we can at least link it
|
||||
if typedesc and is_typefield and content:
|
||||
if (typedesc and is_typefield and content and
|
||||
len(content) == 1 and isinstance(content[0], nodes.Text)):
|
||||
target = content[0].astext()
|
||||
xrefs = typedesc.make_xrefs(
|
||||
typedesc.typerolename,
|
||||
|
@ -38,3 +38,10 @@ module
|
||||
:type y: tuple(str, float)
|
||||
:rtype: list
|
||||
|
||||
.. py:attribute:: attr1
|
||||
|
||||
:type: ModTopLevel
|
||||
|
||||
.. py:attribute:: attr2
|
||||
|
||||
:type: :doc:`index`
|
||||
|
@ -113,7 +113,10 @@ def test_domain_py_xrefs(app, status, warning):
|
||||
assert_refnode(refnodes[9], False, False, 'str', 'class')
|
||||
assert_refnode(refnodes[10], False, False, 'float', 'class')
|
||||
assert_refnode(refnodes[11], False, False, 'list', 'class')
|
||||
assert len(refnodes) == 12
|
||||
assert_refnode(refnodes[11], False, False, 'list', 'class')
|
||||
assert_refnode(refnodes[12], False, False, 'ModTopLevel', 'class')
|
||||
assert_refnode(refnodes[13], False, False, 'index', 'doc', domain='std')
|
||||
assert len(refnodes) == 14
|
||||
|
||||
doctree = app.env.get_doctree('module_option')
|
||||
refnodes = list(doctree.traverse(addnodes.pending_xref))
|
||||
|
Loading…
Reference in New Issue
Block a user