{% load difftags djblets_utils i18n %}

{% definevar 'line_fmt' %}
  <tr line="%(linenum_row)s"%(row_class_attr)s>
{%  if not file.is_new_file %}
   <th>%(anchor_html)s%(linenum1)s</th>
   <td%(cell_1_class_attr)s>
    %(moved_to_html)s
    %(begin_collapse_html)s
    <pre>%(line1)s</pre>
    %(end_collapse_html)s
   </td>
{%  endif %}
   <th>%(linenum2)s</th>
   <td%(cell_2_class_attr)s>
    %(moved_from_html)s
    <pre>%(line2)s</pre>
   </td>
  </tr>
{% enddefinevar %}

<table class="sidebyside text-review-ui-table text-review-ui-comment-thumbnail {{review_ui.extra_css_classes|join:' '}}">
 <colgroup>
{% if is_diff %}
  <col class="line" />
  <col class="left" />
{% endif %}
  <col class="line" />
  <col class="right" />
 </colgroup>
{% if is_diff %}
{%  for chunk in chunks %}
 <tbody {% attr "class" %}{% if chunk.change != "equal" %}{{chunk.change}}{% if chunk.meta.whitespace_chunk %} whitespace-chunk{% endif %}{% endif %}{% endattr %}>
{%   diff_lines 0 chunk True line_fmt %}
 </tbody>
{%  endfor %}
{% else %}
 <tbody>
{% for line in lines %}
  <tr>
   <th>{{line.line_num}}</th>
   <td>{{line.text}}</td>
  </tr>
{% endfor %}
 </tbody>
{% endif %}
</table>
