diff options
author | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-09-20 21:10:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-20 21:10:55 +0100 |
commit | d043d96b09825b2bc3875b253f8978a53ccbb493 (patch) | |
tree | bc65f35b64353744d56176bef909ad244bf207d1 | |
parent | c0efd347cb818c6f2184baa0bd3b1353cec9d126 (diff) | |
download | sphinx-git-d043d96b09825b2bc3875b253f8978a53ccbb493.tar.gz |
Fix section numbering in domain object contents entries (#10830)
-rw-r--r-- | sphinx/environment/collectors/toctree.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sphinx/environment/collectors/toctree.py b/sphinx/environment/collectors/toctree.py index 014dd3ce9..68c730504 100644 --- a/sphinx/environment/collectors/toctree.py +++ b/sphinx/environment/collectors/toctree.py @@ -122,7 +122,8 @@ class TocTreeCollector(EnvironmentCollector): reference = nodes.reference( '', '', nodes.literal('', sig_node['_toc_name']), internal=True, refuri=docname, anchorname=anchorname) - para = addnodes.compact_paragraph('', '', reference) + para = addnodes.compact_paragraph('', '', reference, + skip_section_number=True) entry = nodes.list_item('', para) *parents, _ = sig_node['_toc_parts'] parents = tuple(parents) @@ -185,6 +186,8 @@ class TocTreeCollector(EnvironmentCollector): _walk_toc(subnode, secnums, depth, titlenode) titlenode = None elif isinstance(subnode, addnodes.compact_paragraph): + if 'skip_section_number' in subnode: + continue numstack[-1] += 1 reference = cast(nodes.reference, subnode[0]) if depth > 0: |