From 4f330567e16cda302bb8134c8c2eb66c5cd4af44 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 1 Jun 2024 07:02:45 -0700 Subject: [PATCH] Improve apidoc generation --- support/mkdocstrings_handlers/cxx/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/support/mkdocstrings_handlers/cxx/__init__.py b/support/mkdocstrings_handlers/cxx/__init__.py index b5858d94..399ce706 100644 --- a/support/mkdocstrings_handlers/cxx/__init__.py +++ b/support/mkdocstrings_handlers/cxx/__init__.py @@ -76,7 +76,8 @@ class CxxHandler(BaseHandler): CASE_SENSE_NAMES = NO INPUT = {0}/args.h {0}/base.h {0}/chrono.h {0}/color.h \ {0}/core.h {0}/compile.h {0}/format.h {0}/os.h \ - {0}/ostream.h {0}/printf.h {0}/ranges.h {0}/xchar.h + {0}/ostream.h {0}/printf.h {0}/ranges.h {0}/std.h \ + {0}/xchar.h QUIET = YES JAVADOC_AUTOBRIEF = NO AUTOLINK_SUPPORT = NO @@ -116,16 +117,16 @@ class CxxHandler(BaseHandler): paren = name.find('(') param_str = None if paren > 0: - name, param_str = name[:paren], name[paren:] + name, param_str = name[:paren], name[paren + 1:-1] nodes = self._doxyxml.findall( f"compounddef/sectiondef/memberdef/name[.='{name}']/..") candidates = [] for node in nodes: params = [convert_param(p) for p in node.findall('param')] - node_param_str = '(' + ', '.join([p.type for p in params]) + ')' + node_param_str = ', '.join([p.type for p in params]) if param_str and param_str != node_param_str: - candidates.append(name + node_param_str) + candidates.append(f'{name}({node_param_str})') continue d = Decl(name) d.type = node.find('type').text @@ -147,8 +148,8 @@ class CxxHandler(BaseHandler): def render(self, d: Decl, config: dict) -> str: text = '
'
     text += d.type + ' ' + d.name
-    if d.params:
-      params = ', '.join([p.type for p in d.params])
+    if d.params is not None:
+      params = ', '.join([p.type + ' ' + p.name for p in d.params])
       text += '(' + params + ')'
     text += ';'
     text += '
\n'