{# this file contains helper macros, not intended for rendering but import, imported as util in main templates. Note the whitespace control #} {% macro view_url(view_name, context = g.stop_id) -%} {{ url_for('view', path = view_name, stopId = context, _external = True) }} {%- endmacro %} {% macro static_url(filename) -%} {{ url_for('static', filename = filename, _external = True) }} {%- endmacro %} {% macro home_url(context = g.stop_id, lang = None) -%} {% if not lang -%} {{ url_for('view', path = '', stopId = context, _external = True) }} {%- else -%} {{ url_for('view', path = '', stopId = context, lang = lang, _external = True) }} {%- endif %} {%- endmacro %} {# For format string documentation, see: http://babel.pocoo.org/en/latest/dates.html#pattern-syntax #} {% macro time_short(time) -%} {{ time | datetimeformat(format = 'HH:mm') }} {%- endmacro %} {% macro time_long(time) -%} {{ time | timeformat(format = 'HH:mm:ss') }} {%- endmacro %} {% macro date(time) -%} {{ time | datetimeformat }} {%- endmacro %} {% macro stop_name(full_name = True, context = stop_info) -%} {% if full_name %}{% if context.stop_code %}{{ context.stop_code }}{% else %}{{ context.stop_id }}{% endif %} - {% endif %}{{ context.stop_name }} {%- endmacro %} {# assumes that schedule_row.headsign does not contain the trip/line short_name attribute already, true for Föli data but GTFS does not guarantee this #} {% macro line_name(schedule_row, full_name = False) -%} {% if not full_name or not schedule_row.route -%} {% if schedule_row.route %}{{ schedule_row.route.short_name }} - {% endif %}{{ schedule_row.headsign }} {%- else -%} {{ schedule_row.route.route_name }} {%- endif %} {%- endmacro %} {% macro pagination(context) %} {% if context -%} {%- endif %} {% endmacro %}