mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #9104 from tk0miya/8127_nitpicky_ellipsis
Fix #8127: py domain: Ellipsis in info-field-list causes nit-picky warning
This commit is contained in:
commit
e94944cdd8
1
CHANGES
1
CHANGES
@ -16,6 +16,7 @@ Deprecated
|
|||||||
Features added
|
Features added
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
* #8127: py domain: Ellipsis in info-field-list causes nit-picky warning
|
||||||
* #9023: More CSS classes on domain descriptions, see :ref:`nodes` for details.
|
* #9023: More CSS classes on domain descriptions, see :ref:`nodes` for details.
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
|
@ -304,7 +304,7 @@ class PyXrefMixin:
|
|||||||
def make_xrefs(self, rolename: str, domain: str, target: str,
|
def make_xrefs(self, rolename: str, domain: str, target: str,
|
||||||
innernode: Type[TextlikeNode] = nodes.emphasis,
|
innernode: Type[TextlikeNode] = nodes.emphasis,
|
||||||
contnode: Node = None, env: BuildEnvironment = None) -> List[Node]:
|
contnode: Node = None, env: BuildEnvironment = None) -> List[Node]:
|
||||||
delims = r'(\s*[\[\]\(\),](?:\s*or\s)?\s*|\s+or\s+)'
|
delims = r'(\s*[\[\]\(\),](?:\s*or\s)?\s*|\s+or\s+|\.\.\.)'
|
||||||
delims_re = re.compile(delims)
|
delims_re = re.compile(delims)
|
||||||
sub_targets = re.split(delims, target)
|
sub_targets = re.split(delims, target)
|
||||||
|
|
||||||
|
@ -876,7 +876,9 @@ def test_info_field_list(app):
|
|||||||
"\n"
|
"\n"
|
||||||
" :param str name: blah blah\n"
|
" :param str name: blah blah\n"
|
||||||
" :param age: blah blah\n"
|
" :param age: blah blah\n"
|
||||||
" :type age: int\n")
|
" :type age: int\n"
|
||||||
|
" :param items: blah blah\n"
|
||||||
|
" :type items: Tuple[str, ...]\n")
|
||||||
doctree = restructuredtext.parse(app, text)
|
doctree = restructuredtext.parse(app, text)
|
||||||
print(doctree)
|
print(doctree)
|
||||||
|
|
||||||
@ -890,6 +892,7 @@ def test_info_field_list(app):
|
|||||||
assert_node(doctree[3][1][0][0],
|
assert_node(doctree[3][1][0][0],
|
||||||
([nodes.field_name, "Parameters"],
|
([nodes.field_name, "Parameters"],
|
||||||
[nodes.field_body, nodes.bullet_list, ([nodes.list_item, nodes.paragraph],
|
[nodes.field_body, nodes.bullet_list, ([nodes.list_item, nodes.paragraph],
|
||||||
|
[nodes.list_item, nodes.paragraph],
|
||||||
[nodes.list_item, nodes.paragraph])]))
|
[nodes.list_item, nodes.paragraph])]))
|
||||||
|
|
||||||
# :param str name:
|
# :param str name:
|
||||||
@ -916,6 +919,26 @@ def test_info_field_list(app):
|
|||||||
refdomain="py", reftype="class", reftarget="int",
|
refdomain="py", reftype="class", reftarget="int",
|
||||||
**{"py:module": "example", "py:class": "Class"})
|
**{"py:module": "example", "py:class": "Class"})
|
||||||
|
|
||||||
|
# :param items: + :type items:
|
||||||
|
assert_node(doctree[3][1][0][0][1][0][2][0],
|
||||||
|
([addnodes.literal_strong, "items"],
|
||||||
|
" (",
|
||||||
|
[pending_xref, addnodes.literal_emphasis, "Tuple"],
|
||||||
|
[addnodes.literal_emphasis, "["],
|
||||||
|
[pending_xref, addnodes.literal_emphasis, "str"],
|
||||||
|
[addnodes.literal_emphasis, ", "],
|
||||||
|
[addnodes.literal_emphasis, "..."],
|
||||||
|
[addnodes.literal_emphasis, "]"],
|
||||||
|
")",
|
||||||
|
" -- ",
|
||||||
|
"blah blah"))
|
||||||
|
assert_node(doctree[3][1][0][0][1][0][2][0][2], pending_xref,
|
||||||
|
refdomain="py", reftype="class", reftarget="Tuple",
|
||||||
|
**{"py:module": "example", "py:class": "Class"})
|
||||||
|
assert_node(doctree[3][1][0][0][1][0][2][0][4], pending_xref,
|
||||||
|
refdomain="py", reftype="class", reftarget="str",
|
||||||
|
**{"py:module": "example", "py:class": "Class"})
|
||||||
|
|
||||||
|
|
||||||
def test_info_field_list_var(app):
|
def test_info_field_list_var(app):
|
||||||
text = (".. py:class:: Class\n"
|
text = (".. py:class:: Class\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user