a73x

src/server/http/templates/diff_files.html

Ref:   Size: 1.4 KiB   History

{# The rendered files of a diff. Shared so that a commit's diff and a patch's
   diff cannot drift apart in how they look — only in which trees they compare. #}
<div style="display: grid; gap: 16px;">
  {% for file in diff_files %}
  <section class="diff-file-block">
    <div class="diff-file-heading mono">{{ file.path }}</div>
    {% if file.hunks.is_empty() %}
    <div style="padding: 12px; color: #666;">No textual changes available.</div>
    {% else %}
    <table class="side-by-side-diff">
      <colgroup>
        <col class="diff-line-col">
        <col class="diff-code-col">
        <col class="diff-line-col">
        <col class="diff-code-col">
      </colgroup>
      <thead>
        <tr>
          <th colspan="2">Old</th>
          <th colspan="2">New</th>
        </tr>
      </thead>
      <tbody>
        {% for hunk in file.hunks %}
        <tr>
          <td class="diff-hunk" colspan="4">{{ hunk.header }}</td>
        </tr>
        {% for row in hunk.rows %}
        <tr>
          <td class="diff-line-no diff-{{ row.left.kind }}">{{ row.left.line_no }}</td>
          <td class="diff-code diff-{{ row.left.kind }}">{{ row.left.text }}</td>
          <td class="diff-line-no diff-{{ row.right.kind }}">{{ row.right.line_no }}</td>
          <td class="diff-code diff-{{ row.right.kind }}">{{ row.right.text }}</td>
        </tr>
        {% endfor %}
        {% endfor %}
      </tbody>
    </table>
    {% endif %}
  </section>
  {% endfor %}
</div>