From adb8e27db0a198f73496dc5d8b4741566b5e04e0 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 5 Jun 2024 07:08:21 -0700 Subject: [PATCH] Fix rendering of template parameters --- support/mkdocstrings_handlers/cxx/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/support/mkdocstrings_handlers/cxx/__init__.py b/support/mkdocstrings_handlers/cxx/__init__.py index 63672686..a575a101 100644 --- a/support/mkdocstrings_handlers/cxx/__init__.py +++ b/support/mkdocstrings_handlers/cxx/__init__.py @@ -101,6 +101,9 @@ def convert_return_type(d: Definition, node: et.Element) -> None: if len(parts) > 1: d.trailing_return_type = normalize_type(parts[1]) +def render_param(param: Definition) -> str: + return param.type + (f' {param.name}' if len(param.name) > 0 else '') + def render_decl(d: Definition) -> None: text = '' if d.id is not None: @@ -110,8 +113,7 @@ def render_decl(d: Definition) -> None: text += '
' if d.template_params is not None: text += 'template <' - text += ', '.join( - [f'{p.type} {p.name}'.rstrip() for p in d.template_params]) + text += ', '.join([render_param(p) for p in d.template_params]) text += '>\n' text += '
'