Skip to content

Commit

Permalink
Insert signature name for use with Sphinx Table of Contents (#959)
Browse files Browse the repository at this point in the history
If it's a function, add parentheses to the name.
  • Loading branch information
scottamain authored Jul 30, 2024
1 parent b483706 commit 62695c7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,14 @@ def content(contentnode):
assert len(desc) >= 1
sig = desc[0]
assert isinstance(sig, addnodes.desc_signature)

# Insert the member name for use in Sphinx-generated table of contents.
member_name = node.get_name()
if obj_type == "function":
member_name += "()"
sig.attributes["_toc_name"] = member_name
sig.attributes["_toc_parts"] = member_name

# if may or may not be a multiline signature
isMultiline = sig.get("is_multiline", False)
declarator: Optional[Declarator] = None
Expand Down

0 comments on commit 62695c7

Please sign in to comment.