-
Notifications
You must be signed in to change notification settings - Fork 11
/
module.rst.j2
175 lines (128 loc) · 3.5 KB
/
module.rst.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
.. _{{ module }}_module:
{% if short_description %}
{% set title = module + ' -- ' + short_description | rst_ify %}
{% else %}
{% set title = module %}
{% endif %}
{{ title }}
{{ '=' * title|length }}
.. contents::
:local:
:depth: 1
{% if description -%}
Synopsis
--------
{% for desc in description %}
{{ desc | rst_ify }}
{% endfor %}
{% endif %}
{% if requirements -%}
Requirements
------------
The below requirements are needed on the host that executes this module.
{% for req in requirements %}
- {{ req | rst_ify }}
{% endfor %}
{% endif %}
{% macro option_desc(opts, level) %}
{% for name, spec in opts.items() %}
{% set req = spec.required | default("optional") %}
{% set typ = spec.type | default("any") %}
{% set def_val = spec.default | default("None") %}
{{ " " * level }}{{ name }} ({{ req }}, {{ typ }}, {{ def_val }})
{% for para in spec.description %}
{{ " " * level }}{{ para | rst_ify }}
{% endfor %}
{% if spec.suboptions %}
{{ option_desc(spec.suboptions, level + 1) }}
{% endif %}
{% endfor %}
{% endmacro %}
{% if options -%}
Parameters
----------
{{ option_desc(options, 0) }}
{% endif %}
{% if notes -%}
Notes
-----
.. note::
{% for note in notes %}
- {{ note | rst_ify }}
{% endfor %}
{% endif %}
{% if seealso -%}
See Also
--------
.. seealso::
{% for item in seealso %}
{% if item.module is defined and item.description is defined %}
:ref:`{{ item.module }}_module`
{{ item.description | rst_ify }}
{% elif item.module is defined %}
:ref:`{{ item.module }}_module`
The official documentation on the **{{ item.module }}** module.
{% elif item.name is defined and item.link is defined and item.description is defined %}
`{{ item.name }} <{{ item.link }}>`_
{{ item.description | rst_ify }}
{% elif item.ref is defined and item.description is defined %}
:ref:`{{ item.ref }}`
{{ item.description | rst_ify }}
{% endif %}
{% endfor %}
{% endif %}
{% if examples -%}
Examples
--------
.. code-block:: yaml+jinja
{{ examples | indent(4, True) }}
{% endif %}
{% macro result_desc(results, level) %}
{% for name, spec in results.items() %}
{% set ret = spec.returned %}
{% set typ = spec.type | default("any") %}
{% set sample = spec.sample %}
{{ " " * level }}{{ name }} ({{ ret }}, {{ typ }}, {{ sample }})
{% for para in spec.description %}
{{ " " * level }}{{ para | rst_ify }}
{% endfor %}
{% if spec.contains %}
{{ result_desc(spec.contains, level + 1) }}
{% endif %}
{% endfor %}
{% endmacro %}
{% if returndocs -%}
Return Values
-------------
{{ result_desc(returndocs, 0) }}
{% endif %}
Status
------
{% if deprecated %}
- This {{ plugin_type }} will be removed in version
{{ deprecated['removed_in'] | default('') | string | rst_ify }}.
*[deprecated]*
{% else %}
{% set module_states = {
"preview": "not guaranteed to have a backwards compatible interface",
"stableinterface": "guaranteed to have backward compatible interface changes going forward",
}
%}
{% if metadata %}
{% if metadata.status %}
{% for cur_state in metadata.status %}
- This {{ plugin_type }} is {{ module_states[cur_state] }}. *[{{ cur_state }}]*
{% endfor %}
{% endif %}
{% if metadata.supported_by %}
- This {{ plugin_type }} is maintained by {{ metadata.supported_by }}.
{% endif %}
{% endif %}
{% endif %}
{% if author is defined -%}
Authors
~~~~~~~
{% for author_name in author %}
- {{ author_name }}
{% endfor %}
{% endif %}