{# A single piece of text optionally with a format class. (see https://bulma.io/documentation/helpers/typography-helpers/) #}
{%- macro render_text(text) -%}
{%- if 'class' in text -%} {# Enhanced text #}
{{ text['text'] }}
{%- else -%}
{{ text['text'] }}
{%- endif -%}
{%- endmacro -%}
{# #}
{%- macro render_icon(icon) -%}
{%- endmacro -%}
{# Some text surrounded by a link tag #}
{%- macro render_url(url) -%}
{{ render_element(url['content']) }}
{%- endmacro -%}
{# Renders either plain text or a link depending on the type #}
{%- macro render_element(entry) -%}
{%- if entry is string -%}
{{ entry }}
{%- elif entry['type'] == 'text' -%}
{{ render_text(entry) }}
{%- elif entry['type'] == 'icon' -%}
{{ render_icon(entry) }}
{%- elif entry['type'] == 'url' -%}
{{ render_url(entry) }}
{%- else -%}
{{ raise('Unknown entry type: {}.'.format(entry)) }}
{%- endif -%}
{%- endmacro -%}
{# Renders a list of enumeration entries (either links or text) #}
{%- macro render_enumeration(enumeration) -%}
{%- set divider = joiner(enumeration['divider']) -%}
{{ render_text(enumeration['name']) }}: {% for entry in enumeration['entries'] -%}{{ divider() }}{{ render_element(entry) }}{%- endfor -%}
{%- endmacro -%}