ansible-doctor/ansibledoctor/templates/readme/_vars.j2

58 lines
1.5 KiB
Django/Jinja

{% set var = role.var | default({}) %}
{% if var %}
## Default Variables
{% for key, item in var | dictsort %}
### {{ key }}
{% if item.description is defined and item.description %}
{% set description = [item.description] if item.description is string else item.description %}
{{ description | map("replace", "\n\n", "\n") | safe_join("\n") }}
{% endif %}
{% if item.deprecated is defined or item.type is defined %}
{% if item.deprecated is defined %}
{% set deprecated = [item.deprecated] if item.deprecated is string else item.deprecated %}
{% set deprecated_string = deprecated | map("replace", "\n\n", "\n") | safe_join("\n") %}
{% if deprecated_string %}
**_Deprecated:_** {{ deprecated_string }}<br />
{% else %}
**_Deprecated_**<br />
{% endif %}
{% endif %}
{% if item.type is defined and item.type %}
{% set type = [item.type] if item.type is string else item.type %}
**_Type:_** {{ type | map("replace", "\n\n", "\n") | safe_join("\n") }}<br />
{% endif %}
{% endif %}
{% if item.value is defined and item.value %}
#### Default value
```YAML
{% if item.value is mapping %}
{{ item.value | to_nice_yaml(indent=2) }}
{% else %}
{% for ve_line in item.value %}
{{ ve_line | replace("\n\n", "\n") }}
{% endfor %}
{% endif %}
```
{% endif %}
{% if item.example is defined and item.example %}
#### Example usage
```YAML
{% if item.example is mapping %}
{{ item.example | to_nice_yaml(indent=2) }}
{% else %}
{% for ex_line in item.example %}
{{ ex_line | replace("\n\n", "\n") }}
{% endfor %}
{% endif %}
```
{% endif %}
{% endfor %}
{% endif %}