Browse Source

Tweak display of gists

master
Dylan Baker 5 years ago
parent
commit
852a4245ee
1 changed files with 19 additions and 4 deletions
  1. 19
    4
      templates/gists/show.tera

+ 19
- 4
templates/gists/show.tera View File

@@ -1,14 +1,29 @@
1 1
 <html>
2 2
   <head>
3
-    <title>{{ gist.title }}</title>
3
+    <title>{% if gist %}{{ gist.title }}{% else %}404 - Not Found{% endif %}</title>
4
+    <style>
5
+      pre {
6
+        counter-reset: line;
7
+      }
8
+      code {
9
+        counter-increment: line;
10
+      }
11
+      code:before {
12
+        content: counter(line);
13
+        margin-right: 10px;
14
+      }
15
+    </style>
4 16
   </head>
5 17
   <body>
6 18
     {% if gist %}
7 19
       <h3>{{ gist.title }}</h3>
8 20
       <div>
9
-        <p>
10
-          {{ gist.body }}
11
-        </p>
21
+          {% set lines = gist.body | split(pat = '
22
+') %}
23
+        <pre>
24
+          {%- for line in lines %}<code id="{{ loop.index }}">{{ line }}</code>
25
+{% endfor %}
26
+        </pre>
12 27
       </div>
13 28
     {% else %}
14 29
       <h3>Gist not found</h3>

Loading…
Cancel
Save