rst.j2 2.22 KB
Newer Older
1 2
.. _@{ module }@:

3 4 5 6 7 8 9 10 11 12
{% if short_description %}
{% set title = module + ' - ' + short_description|convert_symbols_to_format %}
{% else %}
{% set title = module %}
{% endif %}
{% set title_len = title|length %}

@{ title }@
@{ '+' * title_len }@

13 14 15 16 17 18 19
{% if author %}
:Author: @{ author }@
{% endif %}

.. contents::
   :local:
   :depth: 1
20 21 22 23 24 25 26 27

{# ------------------------------------------
 #
 # Please note: this looks like a core dump
 # but it isn't one.
 #
 --------------------------------------------#}

28 29 30
Synopsis
--------

31 32 33 34 35
{% if version_added is defined -%}
.. versionadded:: @{ version_added }@
{% endif %}

{% for desc in description -%}
36
@{ desc | convert_symbols_to_format }@
37 38
{% endfor %}

39
{% if options -%}
40 41 42
Options
-------

43 44
.. raw:: html

45
    <table border=1 cellpadding=4>
46
    <tr>
Jan-Piet Mens committed
47 48 49 50 51
    <th class="head">parameter</th>
    <th class="head">required</th>
    <th class="head">default</th>
    <th class="head">choices</th>
    <th class="head">comments</th>
52
    </tr>
53 54
    {% for k in option_keys %}
    {% set v = options[k] %}
55 56
    <tr>
    <td>@{ k }@</td>
57
    <td>{% if v.get('required', False) %}yes{% else %}no{% endif %}</td>
58
    <td>{% if v['default'] %}@{ v['default'] }@{% endif %}</td>
59 60 61
    {% if v.get('type', 'not_bool') == 'bool' %}
    <td><ul><li>yes</li><li>no</li></ul></td>
    {% else %}
62
    <td><ul>{% for choice in v.get('choices',[]) -%}<li>@{ choice }@</li>{% endfor -%}</ul></td>
63
    {% endif %}
64
    <td>{% for desc in v.description -%}@{ desc | html_ify }@{% endfor -%}{% if v['version_added'] %} (added in Ansible @{v['version_added']}@){% endif %}</td>
65 66 67
    </tr>
    {% endfor %}
    </table>
68 69
{% endif %}

70
{% if requirements %}
71
{% for req in requirements %}
72

73
.. note:: Requires @{ req | convert_symbols_to_format }@
74

75
{% endfor %}
76 77
{% endif %}

78 79 80 81
{% if examples or plainexamples %}
Examples
--------

82 83 84
.. raw:: html

{% for example in examples %}
85
    {% if example['description'] %}<p>@{ example['description'] | html_ify }@</p>{% endif %}
86 87
    <p>
    <pre>
88
@{ example['code'] | escape | indent(4, True) }@
89 90
    </pre>
    </p>
91 92 93
{% endfor %}
    <br/>

94 95
{% if plainexamples %}

96
::
97

98
@{ plainexamples | indent(4, True) }@
99
{% endif %}
100
{% endif %}
101

102
{% if notes %}
103
{% for note in notes %}
104
.. note:: @{ note | convert_symbols_to_format }@
105
{% endfor %}
106
{% endif %}
107