mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Close #5977: :var: field do not create a cross-reference
Since its beginning, `:var:` field has created a cross-reference to the attribute having the same name. It is meaningful only if the attribute is documented by `py:attribute` directive. It means the `:var:` field and `:attr:` role are almost the same and conflicted. Additionally, the cross-reference points incorrect variable if the target is not documented. Thus, the cross-reference feature of `:var:` field is disabled.
This commit is contained in:
parent
9cac2001f7
commit
918086b559
2
CHANGES
2
CHANGES
@ -22,6 +22,8 @@ Incompatible changes
|
||||
``<div>``
|
||||
* #8508: LaTeX: uplatex becomes a default setting of latex_engine for Japanese
|
||||
documents
|
||||
* #5977: py domain: ``:var:``, ``:cvar:`` and ``:ivar:`` fields do not create
|
||||
cross-references
|
||||
|
||||
Deprecated
|
||||
----------
|
||||
|
@ -354,7 +354,7 @@ class PyObject(ObjectDescription):
|
||||
'keyword', 'kwarg', 'kwparam'),
|
||||
typerolename='class', typenames=('paramtype', 'type'),
|
||||
can_collapse=True),
|
||||
PyTypedField('variable', label=_('Variables'), rolename='obj',
|
||||
PyTypedField('variable', label=_('Variables'),
|
||||
names=('var', 'ivar', 'cvar'),
|
||||
typerolename='class', typenames=('vartype',),
|
||||
can_collapse=True),
|
||||
|
@ -852,14 +852,12 @@ def test_info_field_list_var(app):
|
||||
|
||||
# :var int attr:
|
||||
assert_node(doctree[1][1][0][0][1][0],
|
||||
([pending_xref, addnodes.literal_strong, "attr"],
|
||||
([addnodes.literal_strong, "attr"],
|
||||
" (",
|
||||
[pending_xref, addnodes.literal_emphasis, "int"],
|
||||
")",
|
||||
" -- ",
|
||||
"blah blah"))
|
||||
assert_node(doctree[1][1][0][0][1][0][0], pending_xref,
|
||||
refdomain="py", reftype="obj", reftarget="attr", **{"py:class": "Class"})
|
||||
assert_node(doctree[1][1][0][0][1][0][2], pending_xref,
|
||||
refdomain="py", reftype="class", reftarget="int", **{"py:class": "Class"})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user