Improve apidoc formatting

This commit is contained in:
Victor Zverovich 2024-06-01 09:05:17 -07:00
parent 91a859ee4a
commit e7ba467e9b
2 changed files with 12 additions and 12 deletions

View File

@ -1,4 +1,4 @@
# API Reference {#string-formatting-api}
# API Reference
The {fmt} library API consists of the following parts:
@ -55,12 +55,8 @@ specified otherwise.
<a id="print"></a>
::: print(format_string<T...>, T&&...)
::: vprint(string_view, format_args)
::: print(FILE*, format_string<T...>, T&&...)
::: vprint(FILE*, string_view, format_args)
::: println(format_string<T...>, T&&...)
::: println(FILE*, format_string<T...>, T&&...)
@ -90,7 +86,8 @@ fmt::format_string
::: runtime(string_view)
### Formatting User-Defined Types {#udt}
<a id="udt"></a>
### Formatting User-Defined Types
The {fmt} library provides formatters for many standard C++ types.
See [`fmt/ranges.h`](#ranges-api) for ranges and tuples including standard

View File

@ -46,11 +46,11 @@ def doxyxml2html(nodes: list[et.Element]):
return out
def get_template_params(node: et.Element) -> Optional[list[Definition]]:
param_nodes = node.findall('templateparamlist/param')
if param_nodes is None:
templateparamlist = node.find('templateparamlist')
if templateparamlist is None:
return None
params = []
for param_node in param_nodes:
for param_node in templateparamlist.findall('param'):
name = param_node.find('declname')
param = Definition(name.text if name is not None else '')
param.type = param_node.find('type').text
@ -161,10 +161,12 @@ class CxxHandler(BaseHandler):
return d
def render(self, d: Definition, config: dict) -> str:
text = '<pre><code>'
text = '<div class="docblock">\n'
text += '<pre><code>'
if d.template_params is not None:
text += 'template &lt;'
text += ', '.join([f'{p.type} {p.name}' for p in d.template_params])
text += ', '.join(
[f'{p.type} {p.name}'.rstrip() for p in d.template_params])
text += '&gt;\n'
text += d.type + ' ' + d.name
if d.params is not None:
@ -173,10 +175,11 @@ class CxxHandler(BaseHandler):
text += '(' + params + ')'
text += ';'
text += '</code></pre>\n'
text += '<div class="docblock">\n'
text += '<div class="docblock-desc">\n'
desc = doxyxml2html(d.desc)
text += desc
text += '</div>\n'
text += '</div>\n'
return text
def get_handler(theme: str, custom_templates: Optional[str] = None,