about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-02-17 17:58:18 +0000
committerAlyssa Ross <hi@alyssa.is>2021-02-17 18:42:31 +0000
commitba72f1c845a8430b289fb8ac94f039c7c1a205c4 (patch)
treec3c163732265db9960d0f4b724647ef52cf387aa
parent6f9ccf054b8af59243e50b24d2c8b36e22ab3ac4 (diff)
downloadpr-tracker-ba72f1c845a8430b289fb8ac94f039c7c1a205c4.tar
pr-tracker-ba72f1c845a8430b289fb8ac94f039c7c1a205c4.tar.gz
pr-tracker-ba72f1c845a8430b289fb8ac94f039c7c1a205c4.tar.bz2
pr-tracker-ba72f1c845a8430b289fb8ac94f039c7c1a205c4.tar.lz
pr-tracker-ba72f1c845a8430b289fb8ac94f039c7c1a205c4.tar.xz
pr-tracker-ba72f1c845a8430b289fb8ac94f039c7c1a205c4.tar.zst
pr-tracker-ba72f1c845a8430b289fb8ac94f039c7c1a205c4.zip
templates: clean up HTML output
The main issue was that the license header from the tree template was
being repeated in the generated HTML every time it was included.  Use
an askama comment to avoid that.

Additionally, reduce the amount of unnecessary whitespace generated a
bit.
-rw-r--r--templates/page.html26
-rw-r--r--templates/tree.html10
2 files changed, 18 insertions, 18 deletions
diff --git a/templates/page.html b/templates/page.html
index 715814a..d433e41 100644
--- a/templates/page.html
+++ b/templates/page.html
@@ -5,9 +5,9 @@
 <html lang="en">
   <head>
     {% match pr_number %}
-    {% when Some with (pr_number) %}
+    {%- when Some with (pr_number) -%}
     <title>Nixpkgs PR #{{ pr_number }} progress</title>
-    {% else %}
+    {%- else -%}
     <title>Nixpkgs PR progress tracker</title>
     {% endmatch %}
 
@@ -169,29 +169,29 @@
     {% endmatch %}
 
     {% match pr_number %}
-    {% when Some with (pr_number) %}
+    {%- when Some with (pr_number) -%}
     <main>
       <ol>
         <li>
-          {% if closed %}
+          {%- if closed -%}
           <span class="state-rejected">❌</span>
-          {% else %}
+          {%- else -%}
           <span class="state-accepted">✅</span>
-          {% endif %}
+          {%- endif -%}
           PR <a href="https://github.com/NixOS/nixpkgs/pull/{{ pr_number }}">#{{ pr_number }}</a>
-          {% if closed %}
+          {%- if closed -%}
           closed
-          {% endif %}
+          {%- endif -%}
         </li>
 
         {% match tree %}
-        {% when Some with (tree) %}
-        {{ tree|safe }}
-        {% else %}
-        {% endmatch %}
+        {%- when Some with (tree) -%}
+        {{- tree|safe -}}
+        {%- else -%}
+        {%- endmatch -%}
       </ol>
     </main>
-    {% else %}
+    {%- else -%}
     {% endmatch %}
     
     <footer>
diff --git a/templates/tree.html b/templates/tree.html
index 5a851a1..caa9c3e 100644
--- a/templates/tree.html
+++ b/templates/tree.html
@@ -1,13 +1,13 @@
-<!-- SPDX-License-Identifier: AGPL-3.0-or-later WITH GPL-3.0-linking-exception -->
-<!-- SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is> -->
+{# SPDX-License-Identifier: AGPL-3.0-or-later WITH GPL-3.0-linking-exception #}
+{#- SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is> -#}
 
 <li>
   {% match accepted %}
-  {% when Some with (true) %}
+  {%- when Some with (true) -%}
   <span class="state-accepted">✅</span>
-  {% when Some with (false) %}
+  {%- when Some with (false) -%}
   <span class="state-pending">⚪</span>
-  {% when None %}
+  {%- when None -%}
   <span class="state-unknown">❓</span>
   {% endmatch %}