{% load difftags djblets_utils reviewtags %}

<table class="sidebyside{% if comment.filediff.source_revision == PRE_CREATION %} newfile{% endif %}">
 <colgroup>
  <col class="line" />
  <col class="left" />
  <col class="line" />
  <col class="right" />
 </colgroup>
 <thead>
  <tr class="filename-row">
   <th colspan="4" class="filename">
    <a href="{{comment.get_absolute_url}}">{{comment.filediff.dest_file_display}}</a>
    <span class="diffrevision">
{% if comment.interfilediff %}
     (Diff revisions {{comment.filediff.diffset.revision}} - {{comment.interfilediff.diffset.revision}})
{% else %}
     (Diff revision {{comment.filediff.diffset.revision}})
{% endif %}
    </span>
   </th>
  </tr>
 </thead>
{% if chunks.0.meta.headers %}
{%  if chunks.0.meta.headers.0 or chunks.0.meta.headers.1 %}
 <tbody class="diff-header">
  <tr>
{%  if chunks.0.meta.headers.0.text == chunks.0.meta.headers.1.text %}
   <td colspan="4"><pre>{{chunks.0.meta.headers.0.text}}</pre></td>
{%  else %}
   <td colspan="2"><pre>{{chunks.0.meta.headers.0.text}}</pre></td>
   <td colspan="2"><pre>{{chunks.0.meta.headers.1.text}}</pre></td>
{%  endif %}
  </tr>
 </tbody>
{%  endif %}
{% endif %}
{% for chunk in chunks %}
 <tbody class="{{chunk.change}}">
{#  <tr><td colspan="4">{{chunk.meta}}</td></tr> #}
{% for line in chunk.lines %}
  <tr{% if chunk.change != "equal" %}{% attr "class" %}{% if forloop.first %}first{% endif %} {% if forloop.last %}last{% endif %}{% endattr %}{% endif %}>
    <th>{{line.1}}</td>
    <td><pre>{{line.2|highlightregion:line.3|showextrawhitespace}}</pre></td>
    <th>{{line.4}}</td>
    <td><pre>{{line.5|highlightregion:line.6|showextrawhitespace}}</pre></td>
  </tr>
{% endfor %}
 </tbody>
{% endfor %}{# chunks #}
</table>
