11{# ------------------------------------------------------------------------ #}
2- {# © Copyright IBM Corporation 2020, 2021 #}
2+ {# Copyright (c) IBM Corporation 2021, 2025 #}
33{# ------------------------------------------------------------------------ #}
44
5- .. _{{ module }}_role:
5+ :github_url: https://github.com/IBM/ibm_zosmf/tree/master/plugins/roles/{{ module }}
6+
7+ .. _{{ module }}_module:
68
79{# ------------------------------------------------------------------------ #}
810{# Generate the title based on the role name and doc description #}
1214{{ title }}
1315{{ '=' * title | length }}
1416
15- {# Disble this syle formatting in leu of list style #}
16- {# {% for desc in description %}
17- {{ desc | rst_ify }}
18-
19- {% endfor %}
20- #}
21-
2217{# ------------------------------------------------------------------------ #}
2318{# Generate top level links #}
2419{# ------------------------------------------------------------------------ #}
3328
3429Synopsis
3530--------
36- {% if description -%}
37-
31+ {% if description %}
3832{% for desc in description %}
3933- {{ desc | rst_ify }}
4034{% endfor %}
41-
4235{% endif %}
4336
4437{# ------------------------------------------------------------------------ #}
4538{# Generate the dependencies based on the doc description #}
4639{# ------------------------------------------------------------------------ #}
4740
48- {% if dependencies - %}
41+ {% if dependencies %}
4942Dependencies
5043------------
5144
@@ -57,7 +50,6 @@ The below requirements are needed on the host that executes this role.
5750
5851{% endif %}
5952
60-
6153{# ------------------------------------------------------------------------ #}
6254{# Parse options and format function #}
6355{# ------------------------------------------------------------------------ #}
@@ -66,27 +58,26 @@ The below requirements are needed on the host that executes this role.
6658{# Control the order of options: true: ordered by name; false: keep source order #}
6759{% set sorted = false %}
6860{% for name , spec in (opts | dictsort if sorted else opts .items ()) if not name .startswith ('_' ) %}
69- {% set req = "required" if spec .required else "optional" %}
70-
71- {# if its a boolean we need to convert to a string for html #}
72- {% if spec .type == 'bool' %}
73- {% set default_str = (spec .default | string | lower ) %}
74- {% elif spec .type == 'int' %}
75- {% set default_str = (spec .default | string ) %}
76- {% else %}
77- {% set default = ", default: " + spec .default if spec .default else "" %}
78- {% endif %}
61+
62+ {# Need to convert defalut value from bool or int to string for html display #}
63+ {% if spec .type == 'bool' or spec .type == 'int' %}
64+ {% set default_str = (spec .default | string ) %}
65+ {% else %}
66+ {% set default_str = spec .default if spec .default else "" %}
67+ {% endif %}
7968
8069{{ " " * level }}{{ name }}
8170{% for para in spec .description %}
8271 {{ " " * level }}{{ para | rst_ify }}
8372
8473{% endfor %}
85-
86- {{ " " * level }}| **required**: {{ spec.required | default("False") }}
74+ {{ " " * level }}| **required**: {{ spec.required | string | default("False") }}
8775 {{ " " * level }}| **type**: {{ spec.type | default("str") }}
88- {% if spec .default %}
89- {{ " " * level }}| **default**: {{ spec.default }}
76+ {% if spec .elements %}
77+ {{ " " * level }}| **elements**: {{ spec.elements }}
78+ {% endif %}
79+ {% if default_str != "" and default_str != "None" %}
80+ {{ " " * level }}| **default**: {{ default_str }}
9081{% endif %}
9182{% if spec .choices %}
9283 {{ " " * level }}| **choices**: {{ ", ".join(spec.choices) }}
@@ -102,9 +93,9 @@ The below requirements are needed on the host that executes this role.
10293{# Generate the options doc #}
10394{# ------------------------------------------------------------- #}
10495
105- {% if options - %}
106- Parameters
107- ----------
96+ {% if options %}
97+ Variables
98+ ---------
10899
109100{{ option_generation(options, 0) }}
110101{% endif %}
@@ -120,92 +111,109 @@ Examples
120111
121112{{ examples | indent(3, True) }}
122113
123-
124114{# ------------------------------------------------------------- #}
125115{# Generate the notes doc #}
126116{# ------------------------------------------------------------- #}
127117
128- {% if notes - %}
118+ {% if notes %}
129119Notes
130120-----
131121
132122.. note::
133123{% for note in notes %}
134- {{ note | rst_ify }}
124+ - {{ note | rst_ify }}
135125
136126{% endfor %}
127+
137128{% endif %}
138129
139130{# ------------------------------------------------------------- #}
140- {# Generate the see also doc #}
131+ {# Generate the set also doc #}
141132{# ------------------------------------------------------------- #}
142133
143- {% if seealso - %}
134+ {% if seealso %}
144135See Also
145136--------
146137
147138.. seealso::
148-
149- {% for item in seealso %}
139+ {% for item in seealso %}
150140 - :ref:`{{ item.module }}_module`
151- {% endfor %}
141+
142+ {% endfor %}
143+
152144{% endif %}
153145
154146{# ------------------------------------------------------------- #}
155147{# Return doc macro #}
156148{# ------------------------------------------------------------- #}
157149
158150{% macro result_generation (results , level ) %}
151+ {% for entry in results %}
152+ {% set _description = results [entry ].description %}
153+ {% set _returned = results [entry ].returned %}
154+ {% set _type = results [entry ].type %}
155+ {% set _elements = results [entry ].elements %}
156+ {% set _contains = results [entry ].contains %}
157+ {% set _sample = results [entry ].sample %}
158+
159+ {{ " " * level }}{{ entry }}
160+ {% if _description is iterable and _description is not string %}
161+ {% for _para in _description %}
162+ {{ " " * level }}{{ _para | rst_ify }}
163+
164+ {% endfor %}
165+ {% else %}
166+ {{ " " * level }}{{ _description | rst_ify }}
159167
160- {% for entry in results %}
168+ {% endif %}
169+ {% if _returned %}
170+ {{ " " * level }}| **returned**: {{ _returned }}
171+ {% endif %}
172+ {% if _type %}
173+ {{ " " * level }}| **type**: {{ _type | default("str") }}
174+ {% endif %}
175+ {% if _elements %}
176+ {{ " " * level }}| **elements**: {{ _elements }}
177+ {% endif %}
178+ {% if _sample %}
179+ {% if _sample .sample 1 %}
180+ {% if _type != 'str' and _type != 'int' %}
181+ {{ " " * level }}| **sample**:
161182
162- {% set _description = results [entry ].description %}
163- {% set _returned = results [entry ].returned %}
164- {% set _type = results [entry ].type %}
165- {% set _contains = results [entry ].contains %}
166- {% set _sample = results [entry ].sample %}
183+ {% for _samplex in _sample %}
184+ {{ " " * level }} .. code-block:: json
167185
168- {{ entry | indent(level, True) }}
169- {% if _description is iterable and _description is not string %}
170- {{ " " * (level) }}| {{ _description[0] }}
171- {% else %}
172- {{ " " * (level) }}| {{ _description }}
173- {% endif %}
186+ {{ " " * level }} {{ _sample[_samplex] | tojson(4) | indent(2*level+8) }}
174187
175- {% if _returned %}
176- {{ " " * level }}| **returned**: {{ _returned }}
177- {% endif %}
178- {{ " " * level }}| **type**: {{ _type }}
188+ {% endfor %}
189+ {% else %}
190+ {{ " " * level }}| **sample**:
179191
180- {% - if _sample -%}
181- {% if _type != 'str' and _type != 'int' %}
182-
183- {{ " " * level }}| **sample**:
192+ {% for _samplex in _sample %}
193+ {{ " " * level }} {{ _sample[_samplex] }}
184194
185- .. code-block::
195+ {% endfor %}
196+ {% endif %}
197+ {% else %}
198+ {% if _type != 'str' and _type != 'int' %}
199+ {{ " " * level }}| **sample**:
186200
187- {{ _sample | tojson }}
188- {% else %}
201+ {{ " " * level }} .. code-block:: json
189202
190- {{ " " * level }}| **sample**: {{ _sample }}
203+ {{ " " * level }} {{ _sample | tojson(4) | indent(2*level+8) }}
191204
192- {% endif %}
193- {% endif % }
205+ {% else %}
206+ {{ " " * level }}| **sample**: {{ _sample } }
194207
195- {% if _contains %}
196- {{ result_generation(_contains, level + 1) }}
197- {% endif %}
208+ {% endif %}
209+ {% endif %}
210+ {% endif %}
211+ {% if _contains %}
212+ {{ result_generation(_contains, level + 1) }}
213+ {% endif %}
214+ {% endfor %}
215+ {% endmacro %}
198216
199- {% endfor %}
200- {% endmacro %}
201217{# ------------------------------------------------------------- #}
202218{# Generate the return values doc #}
203219{# ------------------------------------------------------------- #}
204-
205- {% if returndocs -%}
206- Return Values
207- -------------
208-
209- {{ result_generation(returndocs,1) }}
210- {% endif %}
211-
0 commit comments