{%- macro render_agenda(event, agenda) -%}
    {%- filter underline -%}
        {% trans title=event.title %}Agenda for {{ title }}{% endtrans %}
    {%- endfilter %}
{% if not agenda -%}
    {% trans %}There are no events scheduled.{% endtrans %}
{%- endif -%}

    {%- for item in agenda %}
{{ render_item(item) }}
    {%- endfor -%}
{%- endmacro -%}

{%- macro render_item(item) -%}
    {%- if item.type.name == 'SESSION_BLOCK' -%}
        {{ render_session_block(item) }}
    {%- else -%}
        {{ render_entry(item) }}
    {%- endif -%}
{%- endmacro -%}

{%- macro render_session_block(entry) -%}
    - {{ render_times(entry) }} {{ entry.object.full_title }}
    {%- for item in entry.children %}
    {{ render_entry(item) }}
    {%- endfor -%}
{%- endmacro -%}

{%- macro render_entry(entry) -%}
    - {{ render_times(entry) }} {{ entry.object.title }}
{%- endmacro -%}

{%- macro render_times(entry) -%}
    [{{ entry.start_dt | format_time(timezone=entry.event.tzinfo) }} - {{ entry.end_dt | format_time(timezone=entry.event.tzinfo) }}]
{%- endmacro -%}
