Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blarghmatey/57aaa63ad6cf3da5f981 to your computer and use it in GitHub Desktop.
Save blarghmatey/57aaa63ad6cf3da5f981 to your computer and use it in GitHub Desktop.
{%- macro fluent_config_block(settings, offset=0) -%}
{%- for setting in settings %}
{{ ''|indent(offset, true) }}<{{ setting.directive }} {{ setting.get('directive_arg', '')}}>
{% for attr in setting.attrs -%}
{%- if 'nested_directives' in attr.keys() -%}
{{ fluent_config_block(attr.nested_directives, offset + 2) }}
{% else -%}
{{ attr.keys()[0]|indent(offset + 2, true) }} {{ attr.values()[0] }}
{% endif -%}
{% endfor -%}
{{ ''|indent(offset, true) }}</{{ setting['directive'] }}>
{% endfor -%}
{%- endmacro -%}
{{ fluent_config_block(settings) }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment