mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
core: allow string defaults in yaml templates (#1051)
* allow string defaults in yaml templates * have default_converter handle strings * handle all default values in the yaml * allow for random range options * yaml dump dicts * strip the whities * rip out the converter * accidentally stripped the dicts * goodbye readability
This commit is contained in:
@@ -43,14 +43,18 @@ requires:
|
||||
{%- if option.range_start is defined and option.range_start is number %}
|
||||
{{- range_option(option) -}}
|
||||
{%- elif option.options -%}
|
||||
{%- for suboption_option_id, sub_option_name in option.name_lookup.items() %}
|
||||
{%- for suboption_option_id, sub_option_name in option.name_lookup.items() %}
|
||||
{{ sub_option_name }}: {% if suboption_option_id == option.default %}50{% else %}0{% endif %}
|
||||
{%- endfor -%}
|
||||
{% if option.default == "random" %}
|
||||
random: 50
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{% if option.name_lookup[option.default] not in option.options %}
|
||||
{{ option.default }}: 50
|
||||
{%- endif -%}
|
||||
{%- elif option.default is string %}
|
||||
{{ option.default }}: 50
|
||||
{%- elif option.default is iterable and option.default is not mapping %}
|
||||
{{ option.default | list }}
|
||||
{%- else %}
|
||||
{{ yaml_dump(default_converter(option.default)) | indent(4, first=False) }}
|
||||
{%- endif -%}
|
||||
{{ yaml_dump(option.default) | indent(4, first=false) }}
|
||||
{%- endif -%}
|
||||
{%- endfor %}
|
||||
{% if not options %}{}{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user