32 lines
856 B
Django/Jinja
32 lines
856 B
Django/Jinja
{# _macros.jinja2 #}
|
|
|
|
{% macro get_value(dict, path) %}
|
|
{# Split the path into keys #}
|
|
{% set keys = path.split('.') %}
|
|
{% if keys and dict is mapping and keys[0] in dict %}
|
|
{% set next_value = dict[keys[0]] %}
|
|
{% if keys | length == 1 %}
|
|
{{ next_value }}
|
|
{% else %}
|
|
{{ get_value(next_value, keys[1:] | join('.')) }}
|
|
{% endif %}
|
|
{% else %}
|
|
{{ "" }}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro get_config_platform(package_platform) %}
|
|
{% if package_platform == "Darwin" %}
|
|
macos
|
|
{% elif package_platform == "Windows" %}
|
|
windows
|
|
{% elif package_platform == "Linux" %}
|
|
linux
|
|
{% elif package_platform == "iOS" %}
|
|
ios
|
|
{% elif package_platform == "Android" %}
|
|
android
|
|
{% else %}
|
|
web
|
|
{% endif %}
|
|
{% endmacro %} |