From 62695c7e3eaf1190f7bb02ba7b396daf78da66f4 Mon Sep 17 00:00:00 2001 From: Scott Main Date: Tue, 30 Jul 2024 09:19:54 -0700 Subject: [PATCH] Insert signature name for use with Sphinx Table of Contents (#959) If it's a function, add parentheses to the name. --- breathe/renderer/sphinxrenderer.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/breathe/renderer/sphinxrenderer.py b/breathe/renderer/sphinxrenderer.py index 467c545a..f1aa5035 100644 --- a/breathe/renderer/sphinxrenderer.py +++ b/breathe/renderer/sphinxrenderer.py @@ -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