{#
    Create the diff view when the user clicks the Item History diff button.
    This template is used only if the item has a text content type.

    For text documents, the display begins with a table showing revision info,
    links to new/older revisions, and highlighted text differences.
    The display ends with a rendered view of the newer revision.
#}


{% import "utils.html" as utils with context %}


{% macro revert_button() %}
    {%- if rev_links and rev_links['r2_newer'] -%}
        {# The rendered revision is not the current revision #}
        <div class="moin-diff-revert">
            <a class="moin-button" href="{{ url_for('frontend.revert_item', item_name=item_name, rev=newrev.meta.revid) }}" title="{{ _('revert') }}">
                {{ _('Revert to Revision') }}
                {{ newrev.meta['rev_number'] or newrev.revid|shorten_id }} -
                {{ newrev.meta.mtime|time_datetime }}
            </a>
        </div>
        <div class="moin-float-fix"></div>
    {%- endif -%}
{% endmacro %}


{{ revert_button() }}

{{ utils.diff_table(diffs) }}

{{ revert_button() }}

{# show rendered item #}
{{ rendered | safe }}
