-
Notifications
You must be signed in to change notification settings - Fork 1
/
docs_template.j2
70 lines (58 loc) · 1.91 KB
/
docs_template.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{% macro Parameter(parameter, type, required) -%}
**{{ parameter }}**<br>{{ type }}
{%- if required %} / *required*{% endif -%}
{%- endmacro -%}
{%- macro Choices(choices, default) -%}
{%- if default is none -%}
{%- set default = 'null' -%}
{%- endif -%}
{%- if choices -%}
**Choices:**<br>
{%- set _processed_choices = [] %}
{%- for _item in choices -%}
{%- if _item is none -%}
{%- set _item = 'null' -%}
{%- endif -%}
{%- if _item != default -%}
{% set _choice = '* ' + _item|string %}
{%- else -%}
{% set _choice = '* **' + _item|string + ' ←** (default)' %}
{%- endif -%}
{%- set _processed_choices = _processed_choices.append(_choice) %}
{%- endfor -%}
{{ _processed_choices | join('<br>') }}
{%- endif -%}
{%- if default and not choices -%}
**Default: "{{ default }}"**
{%- endif -%}
{%- endmacro -%}
# {{ full_module_name }} - {{ documentation.short_description }}
## Synopsis
{% for _line in documentation.description -%}
{{ _line }}
{% endfor -%}
## Parameters
| Parameter | Comments |
|----------------------|----------------------|
{% for _parameter in documentation.options -%}
| {{ Parameter(_parameter, documentation.options[_parameter].type, documentation.options[_parameter].required) }} | {{ documentation.options[_parameter].description | join('<br>') }}<br>{{ Choices(documentation.options[_parameter].choices, documentation.options[_parameter].default) }} |
{% endfor %}
{% if documentation.notes -%}
## Notes
{% for _note in documentation.notes -%}
> * {{ _note }}
{% endfor %}
{% endif -%}
## Examples
```yaml
{{ doc_examples }}
```
{% if doc_return is not none -%}
## Return Values
{{ doc_return }}
{%- endif -%}
{#- TODO: Make 'Return Values' block viable (when non-empty 'doc_return' appears in my modules) -#}
## Authors
{% for _author in documentation.author -%}
* {{ _author }}
{% endfor -%}