{# macros to be available to all templates across arxiv #}
{% macro alerts(messages=[]) %}
{% if messages -%}
{% for category, message in messages -%}
{% if message.dismissable %}{% endif %}
{% if message.title %}
{{ message.title }}
{%- endif %}
{{ message.message }}
{%- endfor %}
{%- endif %}
{% endmacro %}
{% macro compactsearch(alignstyle="level-right") -%}
{# Creates an inline search widget with one input box, a dropdown for field
selection, a button, and two tiny help/advanced links. Can be wrapped with
Bulma's level element to align vertically with other elements in the same
horizontal band. Parameter is a Bulma class that sets overall alignment
within level wrapper, allowed values are level-left or level-right.
#}
{%- endmacro %}
{% macro pagination(current_page) -%}
{# Creates a uniform paginator. Currently unfinished - needs parameters
to define range, base URL, and current page.
#}
{%- endmacro %}
{%- macro abs_date_line(arxiv_id, submitted_date, version = 1, submission_history = []) -%}
{% set this_is_the_first_version = version == 1 %}
{% set there_are_more_versions = submission_history and version < submission_history[-1].version %}
{% set this_is_the_latest_version = not submission_history or version == submission_history[-1].version %}
{% if this_is_the_first_version %}
{% set first_version_submitted_date = submitted_date %}
{% else %}
{% set first_version_submitted_date = submission_history[0].submitted_date %}
{% endif %}
{% if this_is_the_latest_version %}
{% set latest_version_submitted_date = submitted_date %}
{% set latest_version = version %}
{% else %}
{% set latest_version_submitted_date = submission_history[-1].submitted_date %}
{% set latest_version = submission_history[-1].version %}
{% endif %}
[Submitted on {{ first_version_submitted_date.strftime('%-d %b %Y') }}
{%- if this_is_the_first_version and there_are_more_versions %} (this version){%- endif -%}
{%- if not this_is_the_first_version %} (v1){%- endif %}
{%- if not this_is_the_first_version and not this_is_the_latest_version -%}
, revised {{ submitted_date.strftime('%-d %b %Y') }} (this version, v{{ version }})
{%- endif -%}
{%- if not this_is_the_latest_version -%}
, latest version {{ latest_version_submitted_date.strftime('%-d %b %Y') }} (v{{ latest_version }})
{%- elif not this_is_the_first_version and this_is_the_latest_version -%}
, last revised {{ latest_version_submitted_date.strftime('%-d %b %Y') }} (this version, v{{ version }})
{%- endif -%}
]
{%- endmacro -%}
{%- macro version_atag(arxiv_id, version, primary_category) -%}
{%- if version -%}
{%- set vpart = 'v' ~ version -%}
{%- else -%}
{%- set vpart = '' -%}
{% endif %}
{%- if primary_category in arxiv_id -%}
arXiv:{{ arxiv_id }}{{vpart}}
{%- else -%}
arXiv:{{ arxiv_id }}{{vpart}} [{{ primary_category }}]
{%- endif -%}
{%- endmacro -%}
{% macro abs(
arxiv_id,
title,
authors,
abstract,
submitted_date,
primary_category,
comments = None,
msc_class = None,
acm_class = None,
journal_ref = None,
doi = None,
report_num = None,
version = 1,
submission_history = [],
secondary_categories = [],
include_stylesheet = 1,
embed_stylesheet = 0,
download_button_markup = None) -%}
{% if include_stylesheet and not embed_stylesheet %}
{% endif %}
{% if embed_stylesheet %}
{% endif %}