{% from "core/macros.jinja" import user_profile_link %}

{% macro page_history(page) %}
  <p>{% trans page_name=page.name %}You're seeing the history of page "{{ page_name }}"{% endtrans %}</p>
  <ul>
    {% set page_name = page.get_full_name() %}
    {%- for rev in page.revisions.order_by("-date").select_related("author") -%}
      <li>
        {% if loop.first %}
          <a href="{{ url('core:page', page_name=page_name) }}">{% trans %}last{% endtrans %}</a>
        {% else %}
          <a href="{{ url('core:page_rev', page_name=page_name, rev=rev.id) }}">{{ rev.revision }}</a>
        {% endif %}
        {{ user_profile_link(rev.author) }} -
        {{ rev.date|localtime|date(DATETIME_FORMAT) }} {{ rev.date|localtime|time(DATETIME_FORMAT) }}
      </li>
    {%- endfor -%}
  </ul>
{% endmacro %}
