You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
973 B
33 lines
973 B
{%- macro config_option_block(options, padding = 0) -%}
|
|
{% for option in (options | d({}) | dict2items) -%}
|
|
{{- '' if padding == 0 else (' ' * padding) -}}
|
|
{% if option.value | type_debug == 'list' -%}
|
|
{{ option.key }} = {{ option.value | join(',') }}
|
|
{% elif option.value is mapping -%}
|
|
{{ option.key ~ ' {\n' ~ config_option_block(option.value, padding + 2) -}}
|
|
{{- ('' if padding == 0 else (' ' * padding)) ~ '}\n' -}}
|
|
{% elif option.value is boolean -%}
|
|
{{ option.key }} = {{ 'yes' if option.value else 'no' }}
|
|
{% elif option.value != None -%}
|
|
{{ option.key }} = {{ option.value }}
|
|
{% endif -%}
|
|
{% endfor -%}
|
|
{%- endmacro -%}
|
|
|
|
|
|
{%- macro config_template(name, cfg, outer_name = None) -%}
|
|
{% if outer_name is string -%}
|
|
{{ outer_name }} {
|
|
{% endif -%}
|
|
|
|
{{- config_option_block(cfg[name], 2 if outer_name is string else 0) -}}
|
|
|
|
{%- if outer_name is string -%}
|
|
}
|
|
{% endif %}
|
|
|
|
{% endmacro -%}
|
|
|
|
|
|
|
|
|
|
|