macOS plist to support arrays
This commit is contained in:
parent
d227d48247
commit
249407784b
|
|
@ -28,14 +28,35 @@
|
||||||
<string>MainMenu</string>
|
<string>MainMenu</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
<!-- flet: prop {% for k, v in cookiecutter.options.info_plist.items() %} -->
|
|
||||||
<key>{{ k }}</key>
|
{% macro render_dict(d) -%}
|
||||||
<!-- flet: True {% if v == True %} -->
|
{% for key, value in d.items() -%}
|
||||||
<true />
|
<key>{{ key }}</key>
|
||||||
<!-- flet: False {% elif v == False %} -->
|
{% if value is string -%}
|
||||||
<false />
|
<string>{{ value }}</string>
|
||||||
<!-- flet: string value {% else %} -->
|
{% elif value is boolean -%}
|
||||||
<string>{{ v }}</string>
|
<{{ "true" if value else "false" }}/>
|
||||||
<!-- flet: end of prop {% endif %} {% endfor %} -->
|
{% elif value is mapping -%}
|
||||||
|
<dict>
|
||||||
|
{{ render_dict(value) }}
|
||||||
|
</dict>
|
||||||
|
{% elif value is sequence -%} {# Support for lists/arrays #}
|
||||||
|
<array>
|
||||||
|
{% for item in value -%}
|
||||||
|
{% if item is string -%}
|
||||||
|
<string>{{ item }}</string>
|
||||||
|
{% elif item is boolean -%}
|
||||||
|
<{{ "true" if item else "false" }}/>
|
||||||
|
{% elif item is mapping -%}
|
||||||
|
<dict>
|
||||||
|
{{ render_dict(item) }}
|
||||||
|
</dict>
|
||||||
|
{% endif -%}
|
||||||
|
{% endfor -%}
|
||||||
|
</array>
|
||||||
|
{% endif -%}
|
||||||
|
{% endfor -%}
|
||||||
|
{% endmacro -%}
|
||||||
|
{{ render_dict(cookiecutter.options.info_plist) }}
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
Loading…
Reference in New Issue