Add param list output

This commit is contained in:
Anthony Johnson 2015-04-13 19:10:19 -07:00
parent 8010a6463f
commit 11cc2b29b9
2 changed files with 31 additions and 8 deletions

View File

@ -23,10 +23,26 @@ class DotNetBase(AutoAPIBase):
# Optional # Optional
self.summary = obj.get('summary', '') self.summary = obj.get('summary', '')
if 'syntax' in obj:
self.syntax = obj['syntax']['content']['CSharp'] # Syntax example and parameter list
else: syntax = obj.get('syntax', None)
self.syntax = '' 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', []) self.children = obj.get('items', [])
if self.children: if self.children:
self.item_map = defaultdict(list) self.item_map = defaultdict(list)

View File

@ -1,12 +1,19 @@
.. dn:{{ type.lower() }}:: {{ name }} .. dn:{{ type.lower() }}:: {{ name }}
{% if summary %} {% if summary %}
{% macro render() %}{{ summary }}{% endmacro %} {% macro render() %}{{ summary }}{% endmacro %}
{{ render()|indent(4) }} {{ 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 }}