diff options
author | Jakob Lykke Andersen <Jakob@caput.dk> | 2021-10-02 13:56:30 +0200 |
---|---|---|
committer | Jakob Lykke Andersen <Jakob@caput.dk> | 2021-10-03 10:17:31 +0200 |
commit | a64196f048ab99e3e482418e73f3ae08145f11bc (patch) | |
tree | 33b2c3125cef0f0088f65f12303d445a120a97a6 | |
parent | 06d3d7356edc0023a6e4fd2deab0320601ef96b9 (diff) | |
download | sphinx-git-a64196f048ab99e3e482418e73f3ae08145f11bc.tar.gz |
js/py nodes, update arglist rendering
-rw-r--r-- | sphinx/domains/python.py | 3 | ||||
-rw-r--r-- | tests/test_domain_js.py | 4 | ||||
-rw-r--r-- | tests/test_domain_py.py | 6 |
3 files changed, 7 insertions, 6 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index b68583cce..cd02eaad5 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -285,7 +285,8 @@ def _pseudo_parse_arglist(signode: desc_signature, arglist: str) -> None: ends_open += 1 argument = argument[:-1].strip() if argument: - stack[-1] += addnodes.desc_parameter(argument, argument) + stack[-1] += addnodes.desc_parameter( + '', '', addnodes.desc_sig_name(argument, argument)) while ends_open: stack.append(addnodes.desc_optional()) stack[-2] += stack[-1] diff --git a/tests/test_domain_js.py b/tests/test_domain_js.py index 4680d88cc..434513063 100644 --- a/tests/test_domain_js.py +++ b/tests/test_domain_js.py @@ -188,8 +188,8 @@ def test_js_function(app): [desc, ([desc_signature, ([desc_name, ([desc_sig_name, "sum"])], desc_parameterlist)], [desc_content, ()])])) - assert_node(doctree[1][0][1], [desc_parameterlist, ([desc_parameter, "a"], - [desc_parameter, "b"])]) + assert_node(doctree[1][0][1], [desc_parameterlist, ([desc_parameter, ([desc_sig_name, "a"])], + [desc_parameter, ([desc_sig_name, "b"])])]) assert_node(doctree[0], addnodes.index, entries=[("single", "sum() (built-in function)", "sum", "", None)]) assert_node(doctree[1], addnodes.desc, domain="js", objtype="function", noindex=False) diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py index 140cb9710..682ea76e1 100644 --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -512,9 +512,9 @@ def test_optional_pyfunction_signature(app): assert_node(doctree[1], addnodes.desc, desctype="function", domain="py", objtype="function", noindex=False) assert_node(doctree[1][0][1], - ([desc_parameter, "source"], - [desc_optional, ([desc_parameter, "filename"], - [desc_optional, desc_parameter, "symbol"])])) + ([desc_parameter, ([desc_sig_name, "source"])], + [desc_optional, ([desc_parameter, ([desc_sig_name, "filename"])], + [desc_optional, desc_parameter, ([desc_sig_name, "symbol"])])])) def test_pyexception_signature(app): |