{# A single line of text with a line break at the end and optionally 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 -%} {# Some text surrounded by a link tag #} {%- macro render_url(url) -%} {{ render_text(url['text']) }} {%- endmacro -%} {# Renders either plain text or a link depending on the type #} {%- macro render_enumeration_entry(entry) -%} {%- if entry['type'] == 'text' -%} {{ render_text(entry) }} {%- elif entry['type'] == 'url' -%} {{ render_url(entry) }} {%- else -%} {{ raise('Unknown entry type.') }} {%- endif -%} {%- endmacro -%} {# Renders a list of enumeration entries (either links or text) #} {%- macro render_enumeration(enumeration) -%} {%- set comma = joiner(", ") -%} {{ render_text(enumeration['name']) }}: {% for entry in enumeration['entries'] -%}{{ comma() }}{{ render_enumeration_entry(entry) }}{%- endfor -%} {%- endmacro -%}