{% macro display_datetime(dt) %}{{ dt.strftime("%a, %d, %b %Y %H:%M %z") }}{% endmacro %} {% macro display_time(dt) %} {% if dt %}{{ dt.strftime("%H:%M %z") }}{% endif %} {% endmacro %} {% macro display_date(dt) %}{{ dt.strftime("%a %-d %b %Y") }}{% endmacro %} {% macro display_date_no_year(dt) %}{{ dt.strftime("%a %-d %b") }}{% endmacro %} {% macro format_distance(distance) %} {{ "{:,.0f} km / {:,.0f} miles".format(distance, distance / 1.60934) }} {% endmacro %} {% macro trip_link(trip) %} {{ trip.title }} {% endmacro %} {% macro conference_row(item, badge, show_flags=True) %} {% set country = get_country(item.country) if item.country else None %}
{{ item.start.strftime("%a, %d %b %Y") }}
{{ item.end.strftime("%a, %d %b") }}
{% if item.url %} {{ item.name }} {% else %} {{ item.name }} {% endif %} {% if item.going and not (item.accommodation_booked or item.travel_booked) %} {{ badge }} {% endif %} {% if item.accommodation_booked %} accommodation {% endif %} {% if item.transport_booked %} transport {% endif %}
{% if item.price and item.currency %} {{ "{:,d}".format(item.price | int) }} {{ item.currency }} {% if item.currency != "GBP" and item.currency in fx_rate %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% elif item.free %} free to attend {% endif %}
{{ item.topic }}
{{ item.location }}
{{ display_date(item.cfp_end) if item.cfp_end else "" }}
{% if country %} {% if show_flags %}{{ country.flag }}{% endif %} {{ country.name }} {% elif item.online %} 💻 Online {% else %} country code {{ item.country }} not found {% endif %}
{% endmacro %} {% macro accommodation_row(item, badge, show_flags=True) %} {% set country = get_country(item.country) %} {% set nights = (item.to.date() - item.from.date()).days %}
{{ item.from.strftime("%a, %d %b %Y") }}
{{ item.to.strftime("%a, %d %b") }}
{% if nights == 1 %}1 night{% else %}{{ nights }} nights{% endif %}
{{ item.operator }}
{{ item.location }}
{% if country %} {% if show_flags %}{{ country.flag }}{% endif %} {{ country.name }} {% else %} country code {{ item.country }} not found {% endif %}
{% if g.user.is_authenticated and item.url %} {{ item.name }} {% else %} {{ item.name }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro flight_booking_row(booking, show_flags=True) %}
{% if g.user.is_authenticated %} {{ booking.booking_reference or "reference missing" }} {% else %} redacted {% endif %}
{% if g.user.is_authenticated and booking.price and booking.currency %} {{ "{:,f}".format(booking.price) }} {{ booking.currency }} {% if booking.currency != "GBP" %} {{ "{:,.2f}".format(booking.price / fx_rate[booking.currency]) }} GBP {% endif %} {% endif %}
{% for i in range(8) %}
{% endfor %} {% for item in booking.flights %} {% set full_flight_number = item.airline + item.flight_number %} {% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{{ item.from }} → {{ item.to }}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ item.duration }}
{{ full_flight_number }}
flightradar24 | FlightAware | radarbox
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{% endfor %} {% endmacro %} {% macro flight_row(item) %} {% set full_flight_number = item.airline + item.flight_number %} {% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{{ item.from }} → {{ item.to }}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ item.duration }}
{{ full_flight_number }}
{% if g.user.is_authenticated %} {{ item.booking_reference }} {% else %} redacted {% endif %}
flightradar24 | FlightAware | radarbox
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro train_row(item) %} {% set url = item.url %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{% if g.user.is_authenticated and item.url %}{% endif %} {{ item.from }} → {{ item.to }} {% if g.user.is_authenticated and item.url %}{% endif %}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.depart != item.arrive and item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ ((item.arrive - item.depart).total_seconds() // 60) | int }} mins
{{ item.operator }}
{% if g.user.is_authenticated %} {{ item.booking_reference }} {% else %} redacted {% endif %}
{% for leg in item.legs %} {% if leg.url %} [{{ loop.index }}] {% endif %} {% endfor %}
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" and item.currency in fx_rate %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro ferry_row(item) %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{{ item.from }} → {{ item.to }}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.depart != item.arrive and item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ item.operator }}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{#
{{ item | pprint }}
#} {% endmacro %} {% macro flag(trip, flag) %}{% if trip.show_flags %}{{ flag }}{% endif %}{% endmacro %} {% macro conference_list(trip) %} {% for item in trip.conferences %} {% set country = get_country(item.country) if item.country else None %}
{{ item.name }} {{ display_date_no_year(item.start) }} to {{ display_date_no_year(item.end) }}

Topic: {{ item.topic }} | Venue: {{ item.venue }} | Location: {{ item.location }} {% if country %} {{ country.flag }} {% elif item.online %} 💻 Online {% else %} country code {{ item.country }} not found {% endif %} {% if item.free %} | free to attend {% elif item.price and item.currency %} | price: {{ item.price }} {{ item.currency }} {% endif %}

{% endfor %} {% endmacro %} {% macro trip_item(trip) %} {% set distances_by_transport_type = trip.distances_by_transport_type() %} {% set total_distance = trip.total_distance() %} {% set end = trip.end %}

{{ trip_link(trip) }} ({{ display_date(trip.start) }})

{% if end %}
Dates: {{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }} {% if g.user.is_authenticated and trip.start <= today %} photos {% endif %}
{% else %}
Start: {{ display_date_no_year(trip.start) }} (end date missing)
{% endif %} {% if total_distance %}
Total distance: {{ format_distance(total_distance) }}
{% endif %} {% if distances_by_transport_type %} {% for transport_type, distance in distances_by_transport_type %}
{{ transport_type | title }} distance: {{format_distance(distance) }}
{% endfor %} {% endif %} {{ conference_list(trip) }} {% for day, elements in trip.elements_grouped_by_day() %}

{{ display_date_no_year(day) }} {% if g.user.is_authenticated and day <= today %} photos {% endif %}

{% set accommodation_label = {"check-in": "check-in from", "check-out": "check-out by"} %} {% for e in elements %} {% if e.element_type in accommodation_label %} {% set c = get_country(e.detail.country) %}
{{ e.get_emoji() }} {{ e.title }} {{ flag(trip, c.flag) }} ({{ accommodation_label[e.element_type] }} {{ display_time(e.start_time) }})
{% else %}
{{ e.get_emoji() }} {{ display_time(e.start_time) }} – {{ e.start_loc }} {{ flag(trip, e.start_country.flag) }} → {{ display_time(e.end_time) }} – {{ e.end_loc }} {{ flag(trip, e.end_country.flag) }} {% if e.element_type == "flight" %} {% set full_flight_number = e.detail.airline + e.detail.flight_number %} {% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %} airline: {{ e.detail.airline_name }} flight number: {{ e.detail.airline }}{{ e.detail.flight_number }} {% if e.detail.duration %} duration: {{ e.detail.duration }} {% endif %} {#
{{ e.detail | pprint }}
#} {% endif %} {% if e.detail.distance %} distance: {{ format_distance(e.detail.distance) }} {% endif %} {% if e.element_type == "flight" %} flightradar24 | FlightAware | radarbox {% endif %}
{% endif %} {% endfor %} {% endfor %}
{% endmacro %}