🐙 Templated web page generator for your git repositories
git clone https://github.com/m-col/gitja
Files | Refs | Readme | License

Commit c7bad829ec6c390d0ba0594e4a96d523b6023d8b
Parent: 0332d3c6a33a38aed478ef97f1055a7020b491f7
Author: mcol <mcol@posteo.net>
Date: 2021-12-07 01:50:51 +0300
Committer: mcol <mcol@posteo.net>
Committed: 2021-12-07 01:50:51 +0300

Add commit diffs to other example templates

templates/stagit/style.css Modified

@@ -167,3 +167,11 @@
 
 .gh, .gp, .cs, .gu, .ne, .cs
 { font-weight: bold }
+
+.diff .add {
+    color: #0a0;
+}
+
+.diff .sub {
+    color: #a00;
+}

templates/stagit/repo/commit.html Modified

@@ -17,5 +17,30 @@
 
 {{ commit.message }}
 </pre>
+
+{%- for diff in commit.diffs -%}
+<div class="diff">
+  <p>
+    <b>{{ diff.new_file }}</b>
+    <span class="status">{{ diff.status }}</span>
+  </p>
+
+  {% if diff.newfile != diff.oldfile %}
+  <p>Renamed from {{ diff.old_file }}</p>
+  {% endif %}
+
+  {%- for hunk in diff.hunks -%}
+  {{ hunk.header }}
+
+  <pre>
+    {%- for line in hunk.lines -%}
+      <span class="{{ line.class }}">{{ line.text }}</span>
+    {%- endfor -%}
+  </pre>
+
+  {%- endfor -%}
+</div>
+{%- endfor -%}
+
 </div>
 {% endblock %}

templates/base/style.css Modified

@@ -21,3 +21,11 @@
 #clone {
     float: right;
 }
+
+.diff .add {
+    color: #0a0;
+}
+
+.diff .sub {
+    color: #a00;
+}

templates/base/repo/commit.html Modified

@@ -12,4 +12,29 @@
 
 {{ commit.message }}
 </pre>
+
+{%- for diff in commit.diffs -%}
+<div class="diff">
+  <p>
+    <b>{{ diff.new_file }}</b>
+    <span class="status">{{ diff.status }}</span>
+  </p>
+
+  {% if diff.newfile != diff.oldfile %}
+  <p>Renamed from {{ diff.old_file }}</p>
+  {% endif %}
+
+  {%- for hunk in diff.hunks -%}
+  {{ hunk.header }}
+
+  <pre>
+    {%- for line in hunk.lines -%}
+      <span class="{{ line.class }}">{{ line.text }}</span>
+    {%- endfor -%}
+  </pre>
+
+  {%- endfor -%}
+</div>
+{%- endfor -%}
+
 {% endblock %}