{% macro render_program(event, days, config, program_config) %} {% for day, entries in days.items() %}

{{ day|format_skeleton('EEEEdMMMM') }}

{% for entry in entries %} {% set show_children_location = program_config.show_children_location[entry.id] %} {% set should_render = ( entry.type.name == 'SESSION_BLOCK' or (entry.type.name == 'CONTRIBUTION' and config.show_contribs) or (entry.type.name == 'BREAK' and config.show_breaks) ) %} {% if should_render %}
{% if entry.type.name != 'CONTRIBUTION' %} {{ _get_color_styles(entry) }} {% endif %}
{{ entry.start_dt|format_time(timezone=event.tzinfo) }}
{{ _render_block_date(entry, day, config.print_date_close_to_sessions) }}
{% if entry.type.name == 'BREAK' %} {{ _render_break(entry, config, program_config) }} {% elif entry.type.name == 'CONTRIBUTION' %} {{ _render_contrib(entry, config, program_config) }} {% elif entry.type.name == 'SESSION_BLOCK' %} {{ _render_session_block(entry, config, program_config, show_children_location) }} {% endif %}
{{ entry.end_dt|format_time(timezone=event.tzinfo) }}
{% endif %} {% endfor %}
{% endfor %} {% endmacro %} {% macro _render_break(entry, config, program_config) %} {% set break = entry.object %}
{{ _render_entry_header(entry, config, program_config) }}
{% endmacro %} {% macro _render_contrib(entry, config, program_config) %} {% set contrib = entry.object %} {% set speakers = contrib.speakers %} {% set subcontribs = contrib.subcontributions %} {% set show_contrib_content = subcontribs or (config.show_abstract and contrib.description) %}
{{ _render_entry_header(entry, config, program_config) }}
{% if show_contrib_content %}
{% if contrib.description %} {{ _render_description(contrib.description) }} {% endif %} {% if subcontribs %} {{ _render_subcontribs(contrib, config) }} {% endif %}
{% endif %} {% endmacro %} {% macro _render_session_block(entry, config, program_config, show_children_location) %} {% set session_block = entry.object %} {% set sess = session_block.session %} {% set conveners = session_block.person_links %} {% set contributions = session_block.contributions %} {% set show_session_block_content = entry.children or (config.show_session_description and sess.description) %}
{{ _render_entry_header(entry, config, program_config) }}
{% if show_session_block_content %}
{% if config.show_session_description and sess.description %} {{ _render_description(sess.description) }} {% endif %} {% set accessible_children = entry.children | selectattr('object', 'can_access', user=session.user) | list %} {% if accessible_children %} {{ _render_block_child_entries(sess, accessible_children, config, show_children_location) }} {% endif %}
{% endif %} {% endmacro %} {% macro _render_block_child_entries(sess, children, config, show_children_location) %}
{% endmacro %} {# The contrib argument can be a Contribution or SubContribution #} {% macro _render_child_contrib(contrib, config, show_location=false) %} {% set speakers = contrib.speakers %} {% if speakers %}

{% trans count=speakers|length -%} Speaker {%- pluralize -%} Speakers {%- endtrans -%}
{{ _render_names(speakers, show_title=config.show_title, show_affiliation=config.show_affiliation) }}

{% endif %} {% if show_location %} {% set loc = _render_place(contrib)|trim %} {% if loc %}

{% trans %}Location{% endtrans %}
{{ loc }}

{% endif %} {% endif %} {% if config.show_abstract and (not contrib.session.is_poster or config.show_poster_abstract) and contrib.description %}
{% trans %}Description{% endtrans %}
{{ contrib.description }}
{% endif %} {% if contrib.subcontributions %} {{ _render_subcontribs(contrib, config) }} {% endif %} {% endmacro %} {% macro _render_subcontribs(contrib, config) %} {% set subcontribs %} {% for subcontrib in contrib.subcontributions %}
  • {% if config.show_length_contribs and (not contrib.session or not contrib.session.is_poster) %} {{ (subcontrib.duration)|format_human_timedelta(narrow=True) }} {% endif %}

    {{ subcontrib.title }}

    {{ _render_subcontrib(subcontrib, config) }}
  • {% endfor%} {% endset %} {% if contrib.session %}
    {% trans %}Subcontributions{% endtrans %}
    {% else %}
    {% endif %} {% endmacro %} {% macro _render_subcontrib(subcontrib, config) %} {{ _render_child_contrib(subcontrib, config) }} {% endmacro %} {% macro _render_entry_header(entry, config, program_config) %} {% set object = entry.object %} {% set sess = object.session %} {% set type = entry.type.name %}

    {{ object.full_title or object.title }}

    {% if type == 'BREAK' %} {% trans %}Break{% endtrans %} {% elif type == 'CONTRIBUTION' %} {% trans %}Contribution{% endtrans %} {% elif sess.is_poster %} {% trans %}Poster Session{% endtrans %} {% elif type == 'SESSION_BLOCK' %} {% trans %}Session{% endtrans %} {% endif %}

    {% if program_config.show_siblings_location %} {% set loc = _render_place(entry)|trim %} {% if loc %}

    {% trans %}Location{% endtrans %}: {{ loc }}

    {% endif %} {% endif %} {% set people = object.person_links if type == 'SESSION_BLOCK' else object.speakers %} {% if type != 'BREAK' and people %} {%- if type == 'SESSION_BLOCK' -%} {% trans count=people|length -%} Convener: {%- pluralize -%} Conveners: {%- endtrans -%} {%- else -%} {% trans count=people|length -%} Speaker: {%- pluralize -%} Speakers: {%- endtrans -%} {%- endif -%}   {{ _render_names(people, show_title=config.show_title, show_affiliation=config.show_affiliation) }} {% endif %}
    {% endmacro %} {% macro _render_block_date(entry, day, print_date_close_to_sessions) %} {% if print_date_close_to_sessions %}

    {{ day|format_skeleton('EEEEdMMMM') }} {{ format_interval(entry.start_dt.astimezone(entry.event.tzinfo), entry.end_dt.astimezone(entry.event.tzinfo), format='short') }}

    {% endif %} {% endmacro %} {# Utilities #} {% macro _render_place(entry) %} {# Entry argument could be both an entry or a data object attached to an entry #} {% set entry = entry.object or entry %} {{ [entry.venue_name, entry.room_name, entry.address] | select | join(', ') | trim }} {% endmacro %} {% macro _render_names(people, show_title=false, show_affiliation=false) %} {% for person in people %} {%- if show_title %} {{ person.title }} {%- endif %} {{ person.display_full_name }} {%- if show_affiliation and person.affiliation %} ({{ person.affiliation }}) {%- endif -%} {%- if not loop.last %},{% endif %} {% endfor %} {% endmacro %} {%- macro _get_custom_id(entry) -%} {{ 'c' ~ entry.type ~ '-' ~ entry.id }} {%- endmacro -%} {% macro _get_color_styles(entry) %} {% set c_id = _get_custom_id(entry) %} {% set colors = entry.object.colors or entry.object.session.colors %} {% endmacro %} {% macro _render_description(description) %}
    {% endmacro %}