{# vim: set ts=2 et sts=2 sw=2: #}
{# TODO: Turn this into a macro. Import it "with context" so datetimeformat can access request.locale. #}
{% if revision_from and revision_to %}
  <section class="revision-diff">
    <header>
      <div class="rev-from">
        <h3>
          {% if revision_from_header %}
            {{ revision_from_header}}
          {% else %}
            <a href="{{ url('wiki.revision', revision_from.document.slug, revision_from.id) }}">
              {{ _('Revision {num}:')|f(num=revision_from.id) }}
            </a>
          {% endif %}
        </h3>
        <p>{{ _('Revision {id} by {user} on {date}')|fe(id=revision_from.id, user=revision_from.creator, date=datetimeformat(revision_from.created, format='longdatetime')) }}</p>
      </div>
      <div class="rev-to">
        <h3>
          {% if revision_to_header %}
            {{ revision_to_header}}
          {% else %}
            <a href="{{ url('wiki.revision', revision_to.document.slug, revision_to.id) }}">
              {{ _('Revision {num}:')|f(num=revision_to.id) }}
            </a>
          {% endif %}
        </h3>
        <p>{{ _('Revision {id} by {user} on {date}')|fe(id=revision_to.id, user=revision_to.creator, date=datetimeformat(revision_to.created, format='longdatetime')) }}</p>
      </div>
    </header>

    <dl>
      <dt>{{ _('Title:') }}</dt>
      <dd class="rev-from">{{ revision_from.title }}</dd>
      <dd class="rev-to">{{ revision_to.title }}</dd>
      
      <dt>{{ _('Slug:') }}</dt>
      <dd class="rev-from">{{ revision_from.slug }}</dd>
      <dd class="rev-to">{{ revision_to.slug }}</dd>
      
      <dt>{{ _('Tags:') }}</dt>
      <dd class="rev-from">{{ revision_from.tags }}</dd>
      <dd class="rev-to">{{ revision_to.tags }}</dd>
      
      <dt>{{ _('Keywords:') }}</dt>
      <dd class="rev-from">{{ revision_from.keywords }}</dd>
      <dd class="rev-to">{{ revision_to.keywords }}</dd>
      
      <dt>{{ _('Search results summary:') }}</dt>
      <dd class="rev-from">{{ revision_from.summary }}</dd>
      <dd class="rev-to">{{ revision_to.summary }}</dd>
      
      <dt>{{ _('Content:') }}</dt>
      <dd>{{ diff_table(revision_from.content, revision_to.content) }}</dd>
    </dl>
  </section>
{% endif %}
