mirror of
https://github.com/fmtlib/fmt.git
synced 2025-08-01 03:34:45 +02:00
Improve apidoc formatting
This commit is contained in:
@@ -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 <'
|
||||
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 += '>\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,
|
||||
|
Reference in New Issue
Block a user