Add param list output

go-templates
Anthony Johnson 10 years ago
parent 8010a6463f
commit 11cc2b29b9

@ -23,10 +23,26 @@ class DotNetBase(AutoAPIBase):
# Optional
self.summary = obj.get('summary', '')
if 'syntax' in obj:
self.syntax = obj['syntax']['content']['CSharp']
else:
self.syntax = ''
# Syntax example and parameter list
syntax = obj.get('syntax', None)
self.example = ''
if syntax is not None:
# Code example
try:
self.example = syntax['content']['CSharp']
except KeyError:
pass
self.parameters = []
for param in syntax.get('parameters', []):
if 'id' in param:
self.parameters.append({
'name': param.get('id'),
'type': param.get('type', {}).get('id', None),
'desc': param.get('description', '')
})
self.children = obj.get('items', [])
if self.children:
self.item_map = defaultdict(list)

@ -1,12 +1,19 @@
.. dn:{{ type.lower() }}:: {{ name }}
{% if summary %}
{% if summary %}
{% macro render() %}{{ summary }}{% endmacro %}
{{ render()|indent(4) }}
{% endif %}
{% endif %}
.. code-block:: csharp
{%- for param in parameters %}
:param {{ param.name }}: {{ param.desc }}
{%- if param.type %}
:type {{ param.name }}: {{ param.type }}
{%- endif %}
{%- endfor %}
{{ syntax }}
.. code-block:: csharp
{{ example }}

Loading…
Cancel
Save