{% include 'pagerMacros.html' %} {% include 'pagerMacros.html' %} {# use renderEvents to show all items as full posts on a page #} {% macro renderEvents(items, pageUrl) %} {% if items %} {% for item in items %} {{ renderEvent(item, pageUrl) }} {% endfor %} {% else %}

There are no events yet.

{% endif %} {% endmacro %} {% macro renderEvent(item, pageUrl) %}

{{ item.title | e }}

{{ eventDateRange(item) }}
{{ aposArea({ area: item.areas.body }) }}
{% if item.tags %}
File under: {% for tag in item.tags %} {{ tag | e }} {% endfor %}
{% endif %} {% endmacro %} {# ...or use renderEventPreviews to show previews of all items on a page (date and title) #} {% macro renderEventPreviews(items, pageUrl) %} {% if items %} {% for item in items %} {{ renderEventPreview(item, pageUrl) }} {% endfor %} {% else %}

There are no events yet.

{% endif %} {% endmacro %} {% macro renderEventPreview(item, pageUrl) %}

{{ item.title | e }}

{{ eventDateRange(item) }}
{% endmacro %} {# Outputs a date and, if present, a time. The date is presented without the year unless it #} {# is a different year than the present year. Pass the entire timestamp, not just date, and #} {# pass the time (if the time is null, it is not output). See eventDateRange #} {% macro eventDateAndTime(when, timePresent) %} {% if aposIsCurrentYear(when) %} {{ when | date('MMM DD') }} {% else %} {{ when | date('MMM DD [\']YY') }} {% endif %} {% if (timePresent) %} {{ when | date('h:mm a') }} {% endif %} {% endmacro %} {# Copes with startDate, startTime, endDate and endTime, all but the first of which #} {# are optional, and outputs something reasonable for each combination. NOTE: #} {# RSS feeds use this. #} {% macro eventDateRange(item) %} {{ eventDateAndTime(item.start, item.startTime) }} {% if (item.startDate != item.endDate) or (item.startTime != item.endTime) %} – {{ eventDateAndTime(item.end, item.endTime) }} {% endif %} {% endmacro %}