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

Commit cdd1319b7ee914ea6c7ec9746ad974e18aff813e
Parent: 09d784a0035847a9be309761b1d0464130fa6bef
Author: mcol <mcol@posteo.net>
Date: 2021-11-27 00:53:48 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-11-27 00:53:48 +0000

make new template for the docs website

templates/template.html.include Deleted

@@ -1,19 +0,0 @@
-{#- This is the base template used for all pages. -#}
-{#- Style credit goes to stagit. -#}
-
-<!doctype html>
-<html lang="en">
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="x-ua-compatible" content="ie=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>{% block title %}{% endblock %}</title>
-    <link rel="stylesheet" type="text/css" href="{{ host }}/style.css"/>
-    <link rel="icon" type="image/png" href="/favicon.png"/>
-  </head>
-  <body>
-
-  {% block body %}
-  {% endblock %}
-  </body>
-</html>

templates/style.css Deleted

@@ -1,169 +0,0 @@
-/*
-Credit to much of the styling here goes to stagit: https://codemadness.org/git/stagit/
-*/
-
-@viewport {
-    width: device-width;
-    zoom: 1.0;
-}
-
-html {
-    color: #000;
-    font-family: monospace;
-    font-size: 1em;
-}
-
-body {
-    max-width: 900px;
-}
-
-p {
-    margin: 15px 0;
-}
-
-li {
-    list-style-type: square;
-}
-
-h1, h2 {
-    font-size: 1em;
-    margin: 0;
-}
-
-h2 {
-    font-weight: bold;
-    text-decoration: underline;
-}
-
-::selection {
-    background: #5D479D;
-    color: #fff;
-}
-
-table td {
-    padding: 0 0.4em;
-}
-
-td.link {
-    text-align: right;
-}
-
-a:target {
-    background-color: #ddd;
-}
-
-#avatar {
-    width: 32px;
-    height: 32px;
-}
-
-a.d, a.h, a.i, a.line {
-    text-decoration: none;
-}
-
-#blob a, .desc {
-    color: #777;
-}
-
-#blob a:hover {
-    color: blue;
-    text-decoration: none;
-}
-
-table thead td {
-    font-weight: bold;
-}
-
-#content table td {
-    vertical-align: top;
-    white-space: nowrap;
-}
-
-#head {
-    width: 100%;
-}
-
-#branches tr:hover td,
-#tags tr:hover td,
-#index tr:hover td,
-#log tr:hover td,
-#files tr:hover td {
-    background-color: #eee;
-}
-
-#index tr td:nth-child(2),
-#tags tr td:nth-child(3),
-#branches tr td:nth-child(3),
-#log tr td:nth-child(2) {
-    white-space: normal;
-}
-
-td.num {
-    text-align: right;
-}
-
-hr {
-    border: 0;
-    border-top: 1px solid #777;
-    height: 1px;
-}
-
-pre a.h {
-    color: #00a;
-}
-
-.A,
-span.i,
-pre a.i {
-    color: #070;
-}
-
-.D,
-span.d,
-pre a.d {
-    color: #e00;
-}
-
-pre a.h:hover,
-pre a.i:hover,
-pre a.d:hover {
-    text-decoration: none;
-}
-
-.highlight, code {
-    background: #eeeeef;
-    color: black;
-}
-
-.highlight {
-    white-space: pre-wrap;
-    word-wrap: break-word;
-}
-
-.c, .ch, .cm, .cp, .cpf, .c1, .gh, .gp
-{ color: #5D479D } /* comments */
-
-.err, .se, .o
-{ color: #a53c21 } /* dark red */
-
-.sh, .si, .sx, .sr, .s1, .ss, .cs, .gd, .dl,
-.s2, .nc, .vc, .vg, .vi, .vm, .nv, .sc, .s
-{ color: #8f4ff0 } /* bright pink */
-
-.kn, .nb, .mb, .mf, .mh, .mi, .mo, .bp, .il, .m
-{ color: #406794 } /* keywords (exit, eval) */
-
-.kt
-{ color: #3e3e73 } /* light grey */
-
-.kc, .k, .ow, .kp, .kr
-{ color: #406794 } /* key words */
-
-.esc, .l, .n, .x, .p, .gs, .ld, .na, .no, .ge
-.nd, .ni, .nf, .nl, .nn, .nx, .py, .nt, .w, .fm, .g
-{ color: black }
-
-.ne { color: #5fd75f }
-
-.gh, .gp, .cs, .gu, .ne, .cs
-{ font-weight: bold }

templates/stagit/template.html.include Added

@@ -0,0 +1,19 @@
+{#- This is the base template used for all pages. -#}
+{#- Style credit goes to stagit. -#}
+
+<!doctype html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="x-ua-compatible" content="ie=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>{% block title %}{% endblock %}</title>
+    <link rel="stylesheet" type="text/css" href="{{ host }}/style.css"/>
+    <link rel="icon" type="image/png" href="/favicon.png"/>
+  </head>
+  <body>
+
+  {% block body %}
+  {% endblock %}
+  </body>
+</html>

templates/stagit/style.css Added

@@ -0,0 +1,169 @@
+/*
+Credit to much of the styling here goes to stagit: https://codemadness.org/git/stagit/
+*/
+
+@viewport {
+    width: device-width;
+    zoom: 1.0;
+}
+
+html {
+    color: #000;
+    font-family: monospace;
+    font-size: 1em;
+}
+
+body {
+    max-width: 900px;
+}
+
+p {
+    margin: 15px 0;
+}
+
+li {
+    list-style-type: square;
+}
+
+h1, h2 {
+    font-size: 1em;
+    margin: 0;
+}
+
+h2 {
+    font-weight: bold;
+    text-decoration: underline;
+}
+
+::selection {
+    background: #5D479D;
+    color: #fff;
+}
+
+table td {
+    padding: 0 0.4em;
+}
+
+td.link {
+    text-align: right;
+}
+
+a:target {
+    background-color: #ddd;
+}
+
+#avatar {
+    width: 32px;
+    height: 32px;
+}
+
+a.d, a.h, a.i, a.line {
+    text-decoration: none;
+}
+
+#blob a, .desc {
+    color: #777;
+}
+
+#blob a:hover {
+    color: blue;
+    text-decoration: none;
+}
+
+table thead td {
+    font-weight: bold;
+}
+
+#content table td {
+    vertical-align: top;
+    white-space: nowrap;
+}
+
+#head {
+    width: 100%;
+}
+
+#branches tr:hover td,
+#tags tr:hover td,
+#index tr:hover td,
+#log tr:hover td,
+#files tr:hover td {
+    background-color: #eee;
+}
+
+#index tr td:nth-child(2),
+#tags tr td:nth-child(3),
+#branches tr td:nth-child(3),
+#log tr td:nth-child(2) {
+    white-space: normal;
+}
+
+td.num {
+    text-align: right;
+}
+
+hr {
+    border: 0;
+    border-top: 1px solid #777;
+    height: 1px;
+}
+
+pre a.h {
+    color: #00a;
+}
+
+.A,
+span.i,
+pre a.i {
+    color: #070;
+}
+
+.D,
+span.d,
+pre a.d {
+    color: #e00;
+}
+
+pre a.h:hover,
+pre a.i:hover,
+pre a.d:hover {
+    text-decoration: none;
+}
+
+.highlight, code {
+    background: #eeeeef;
+    color: black;
+}
+
+.highlight {
+    white-space: pre-wrap;
+    word-wrap: break-word;
+}
+
+.c, .ch, .cm, .cp, .cpf, .c1, .gh, .gp
+{ color: #5D479D } /* comments */
+
+.err, .se, .o
+{ color: #a53c21 } /* dark red */
+
+.sh, .si, .sx, .sr, .s1, .ss, .cs, .gd, .dl,
+.s2, .nc, .vc, .vg, .vi, .vm, .nv, .sc, .s
+{ color: #8f4ff0 } /* bright pink */
+
+.kn, .nb, .mb, .mf, .mh, .mi, .mo, .bp, .il, .m
+{ color: #406794 } /* keywords (exit, eval) */
+
+.kt
+{ color: #3e3e73 } /* light grey */
+
+.kc, .k, .ow, .kp, .kr
+{ color: #406794 } /* key words */
+
+.esc, .l, .n, .x, .p, .gs, .ld, .na, .no, .ge
+.nd, .ni, .nf, .nl, .nn, .nx, .py, .nt, .w, .fm, .g
+{ color: black }
+
+.ne { color: #5fd75f }
+
+.gh, .gp, .cs, .gu, .ne, .cs
+{ font-weight: bold }

templates/stagit/repo/tree.html Added

@@ -0,0 +1,29 @@
+{% extends "../template.html.include" %}
+
+{%- block title -%}
+{{ name }} - target
+{%- endblock -%}
+
+{% block body %}
+{% include "repo-table-header.html.include" %}
+
+<div id="content">
+  <table id="files">
+    <thead>
+      <tr>
+        <td><b>Mode</b></td>
+        <td><b>Name</b></td>
+      </tr>
+    </thead>
+
+    <tbody>
+      {% for file in tree %}
+      <tr>
+        <td>{{ file.mode_symbolic }}</td>
+        <td><a href="{{ host }}/{{ name }}/file/{{ file.href }}">{{ file.path }}</a></td>
+      </tr>
+      {% endfor %}
+    </tbody>
+  </table>
+</div>
+{% endblock %}

templates/stagit/repo/repo-table-header.html.include Added

@@ -0,0 +1,24 @@
+{#- This block is rendered at the top of every page. -#}
+
+<table id="head">
+  <tr>
+    <td width="32px" rowspan="2"><a href="{{ host }}"><img src="{{ host }}/avatar.png" id="avatar"/></a></td>
+    <td rowspan="2"><a href="{{ host }}">{{ host }}</a> / <a href="{{ host }}">code</a> / <a href="{{ host }}/{{ name }}">{{ name }}</a></td>
+    <td class="link"><a href="{{ host }}/posts.html">posts</a></td>
+  </tr>
+  <tr>
+    <td class="link"><a href="{{ host }}/about.html">about</a></td>
+  </tr>
+</table>
+<hr>
+
+<table>
+  <tr><td><span class="desc">{{ description }}</span></td></tr>
+  <tr class="url"><td>git clone <a href="{{ host }}/{{ name }}">{{ host }}/{{ name }}</a></td></tr>
+  <tr><td>
+    <a href="{{ host }}/{{ name }}/tree.html">Files</a> | <a href="{{ host }}/{{ name }}/refs.html">Refs</a>
+    {% if readme %} | <a href="{{ host }}/{{ name }}/file/{{ readme.href }}">Readme</a>{% endif %}
+    {% if license %} | <a href="{{ host }}/{{ name }}/file/{{ license.href }}">License</a>{% endif %}
+  </td></tr>
+</table>
+<hr>

templates/stagit/repo/refs.html Added

@@ -0,0 +1,37 @@
+{% extends "../template.html.include" %}
+
+{%- block title -%}
+{{ name }} - Refs
+{%- endblock -%}
+
+{% block body %}
+{% include  "repo-table-header.html.include" %}
+
+<div id="content">
+  <h2>Branches</h2>
+  <table id="branches">
+    <thead>
+      <tr><td><b>Name</b></td><td colspan="2"><b>Last commit</b></td><td><b>Author</b></td></tr>
+    </thead>
+    <tbody>
+      {% for branch in branches %}
+      <tr><td>{{ branch.name }}</td><td>{{ branch.authored[:16] }}</td><td>{{ branch.title }}</td><td>{{ branch.author }}</td></tr>
+      {% endfor %}
+    </tbody>
+  </table>
+
+  <br>
+
+  <h2>Tags</h2>
+  <table id="tags">
+    <thead>
+      <tr><td><b>Name</b></td><td colspan="2"><b>Last commit</b></td><td><b>Author</b></td></tr>
+    </thead>
+    <tbody>
+      {% for tag in tags %}
+      <tr><td>{{ tag.name }}</td><td>{{ tag.authored[:16] }}</td><td>{{ tag.title }}</td><td>{{ tag.author }}</td></tr>
+      {% endfor %}
+    </tbody>
+  </table>
+</div>
+{% endblock %}

templates/stagit/repo/index.html Added

@@ -0,0 +1,27 @@
+{% extends "../template.html.include" %}
+
+{%- block title -%}
+{{ description }}
+{%- endblock -%}
+
+{% block body %}
+{% include "repo-table-header.html.include" %}
+
+<div id="content">
+  <table id="log">
+    <thead>
+      <tr>
+        <td><b>Date</b></td>
+        <td><b>Commit message</b></td>
+        <td><b>Author</b></td>
+      </tr>
+    </thead>
+
+    <tbody>
+      {% for commit in commits[:50] %}
+      <tr><td>{{ commit.authored[:16] }}</td><td><a href="commit/{{ commit.id }}.html">{{ commit.title }}</a></td><td>{{ commit.author }}</td></tr>
+      {% endfor %}
+    </tbody>
+  </table>
+</div>
+{% endblock %}

templates/stagit/repo/file.html Added

@@ -0,0 +1,39 @@
+{% extends "../template.html.include" %}
+
+{%- block title -%}
+{{ name }} - {{ file }}
+{%- endblock -%}
+
+{% block body %}
+{% include "repo-table-header.html.include" %}
+
+<div id="content">
+  <p>{{ file.mode_symbolic }} {{ file }}</p><hr>
+
+{% if file.is_directory %}
+  <table id="files">
+    <thead>
+      <tr>
+        <td><b>Mode</b></td>
+        <td><b>Name</b></td>
+      </tr>
+    </thead>
+
+    <tbody>
+      {% for child in file.contents %}
+      <tr>
+        <td>{{ child.mode_symbolic }}</td>
+        <td><a href="{{ host }}/{{ name }}/file/{{ child.href }}">{{ child.path }}</a></td>
+      </tr>
+      {% endfor %}
+    </tbody>
+  </table>
+{% else %}
+  <pre id="blob">
+{% for line in split(file.contents, '\n') %}
+<a href="#l{{ loop.index }}" class="line" id="l{{ loop.index }}">{{ printf("%7v", loop.index) }}</a> {{ line }}
+{% endfor %}
+{% endif %}
+  </pre>
+</div>
+{% endblock %}

templates/stagit/repo/commit.html Added

@@ -0,0 +1,21 @@
+{% extends "../template.html.include" %}
+
+{%- block title -%}
+{{ name }} - {{ commit.title }}
+{%- endblock -%}
+
+{% block body %}
+{% include "repo-table-header.html.include" %}
+
+<div id="content">
+  <pre><b>Commit</b> <a href="{{ host }}/{{ name }}/commit/{{ commit.id }}.html">{{ commit.id }}</a>
+<b>Parent:</b> <a href="{{ host }}/{{ name }}/commit/{{ commit.parent }}.html">{{ commit.parent }}</a>
+<b>Author:</b> {{ commit.author }} &lt;<a href="mailto:{{ commit.author_email }}">{{ commit.author_email }}</a>&gt;
+<b>Date:</b> {{ commit.authored }}
+<b>Committer:</b> {{ commit.committer }} &lt;<a href="mailto:{{ commit.committer_email }}">{{ commit.committer_email }}</a>&gt;
+<b>Committed:</b> {{ commit.committed }}
+
+{{ commit.message }}
+</pre>
+</div>
+{% endblock %}

templates/stagit/index.html Added

@@ -0,0 +1,28 @@
+{% extends "template.html.include" %}
+
+{%- block title -%}
+gitserve - Index
+{%- endblock -%}
+
+{% block body %}
+<table id="head">
+  <tr><td width="32px" rowspan="2"><a href="{{ host }}"><img src="{{ host }}/avatar.png" id="avatar"/></a></td>
+    <td rowspan="2"><a href="{{ host }}">{{ host }}</a> / <a href="{{ host }}">code</a></td><td class="link"><a href="{{ host }}/posts.html">posts</a></td></tr><tr><td class="link"><a href="{{ host }}/about.html">about</a></td></tr>
+</table>
+
+<hr>
+
+<div id="content">
+  <table id="index">
+    <thead>
+      <tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Last commit</b></td></tr>
+    </thead>
+
+    <tbody>
+      {% for repo in repositories %}
+      <tr><td><a href="{{ repo.name }}">{{ repo.name }}</a></td><td>{{ repo.description }}</td><td>{{ repo.updated[:16] }}</td></tr>
+      {% endfor %}
+    </tbody>
+  </table>
+</div>
+{% endblock %}

templates/repo/tree.html Deleted

@@ -1,29 +0,0 @@
-{% extends "../template.html.include" %}
-
-{%- block title -%}
-{{ name }} - target
-{%- endblock -%}
-
-{% block body %}
-{% include "repo-table-header.html.include" %}
-
-<div id="content">
-  <table id="files">
-    <thead>
-      <tr>
-        <td><b>Mode</b></td>
-        <td><b>Name</b></td>
-      </tr>
-    </thead>
-
-    <tbody>
-      {% for file in tree %}
-      <tr>
-        <td>{{ file.mode_symbolic }}</td>
-        <td><a href="{{ host }}/{{ name }}/file/{{ file.href }}">{{ file.path }}</a></td>
-      </tr>
-      {% endfor %}
-    </tbody>
-  </table>
-</div>
-{% endblock %}

templates/repo/repo-table-header.html.include Deleted

@@ -1,24 +0,0 @@
-{#- This block is rendered at the top of every page. -#}
-
-<table id="head">
-  <tr>
-    <td width="32px" rowspan="2"><a href="{{ host }}"><img src="{{ host }}/avatar.png" id="avatar"/></a></td>
-    <td rowspan="2"><a href="{{ host }}">{{ host }}</a> / <a href="{{ host }}">code</a> / <a href="{{ host }}/{{ name }}">{{ name }}</a></td>
-    <td class="link"><a href="{{ host }}/posts.html">posts</a></td>
-  </tr>
-  <tr>
-    <td class="link"><a href="{{ host }}/about.html">about</a></td>
-  </tr>
-</table>
-<hr>
-
-<table>
-  <tr><td><span class="desc">{{ description }}</span></td></tr>
-  <tr class="url"><td>git clone <a href="{{ host }}/{{ name }}">{{ host }}/{{ name }}</a></td></tr>
-  <tr><td>
-    <a href="{{ host }}/{{ name }}/tree.html">Files</a> | <a href="{{ host }}/{{ name }}/refs.html">Refs</a>
-    {% if readme %} | <a href="{{ host }}/{{ name }}/file/{{ readme.href }}">Readme</a>{% endif %}
-    {% if license %} | <a href="{{ host }}/{{ name }}/file/{{ license.href }}">License</a>{% endif %}
-  </td></tr>
-</table>
-<hr>

templates/repo/refs.html Deleted

@@ -1,37 +0,0 @@
-{% extends "../template.html.include" %}
-
-{%- block title -%}
-{{ name }} - Refs
-{%- endblock -%}
-
-{% block body %}
-{% include  "repo-table-header.html.include" %}
-
-<div id="content">
-  <h2>Branches</h2>
-  <table id="branches">
-    <thead>
-      <tr><td><b>Name</b></td><td colspan="2"><b>Last commit</b></td><td><b>Author</b></td></tr>
-    </thead>
-    <tbody>
-      {% for branch in branches %}
-      <tr><td>{{ branch.name }}</td><td>{{ branch.authored[:16] }}</td><td>{{ branch.title }}</td><td>{{ branch.author }}</td></tr>
-      {% endfor %}
-    </tbody>
-  </table>
-
-  <br>
-
-  <h2>Tags</h2>
-  <table id="tags">
-    <thead>
-      <tr><td><b>Name</b></td><td colspan="2"><b>Last commit</b></td><td><b>Author</b></td></tr>
-    </thead>
-    <tbody>
-      {% for tag in tags %}
-      <tr><td>{{ tag.name }}</td><td>{{ tag.authored[:16] }}</td><td>{{ tag.title }}</td><td>{{ tag.author }}</td></tr>
-      {% endfor %}
-    </tbody>
-  </table>
-</div>
-{% endblock %}

templates/repo/index.html Deleted

@@ -1,27 +0,0 @@
-{% extends "../template.html.include" %}
-
-{%- block title -%}
-{{ description }}
-{%- endblock -%}
-
-{% block body %}
-{% include "repo-table-header.html.include" %}
-
-<div id="content">
-  <table id="log">
-    <thead>
-      <tr>
-        <td><b>Date</b></td>
-        <td><b>Commit message</b></td>
-        <td><b>Author</b></td>
-      </tr>
-    </thead>
-
-    <tbody>
-      {% for commit in commits[:50] %}
-      <tr><td>{{ commit.authored[:16] }}</td><td><a href="commit/{{ commit.id }}.html">{{ commit.title }}</a></td><td>{{ commit.author }}</td></tr>
-      {% endfor %}
-    </tbody>
-  </table>
-</div>
-{% endblock %}

templates/repo/file.html Deleted

@@ -1,39 +0,0 @@
-{% extends "../template.html.include" %}
-
-{%- block title -%}
-{{ name }} - {{ file }}
-{%- endblock -%}
-
-{% block body %}
-{% include "repo-table-header.html.include" %}
-
-<div id="content">
-  <p>{{ file.mode_symbolic }} {{ file }}</p><hr>
-
-{% if file.is_directory %}
-  <table id="files">
-    <thead>
-      <tr>
-        <td><b>Mode</b></td>
-        <td><b>Name</b></td>
-      </tr>
-    </thead>
-
-    <tbody>
-      {% for child in file.contents %}
-      <tr>
-        <td>{{ child.mode_symbolic }}</td>
-        <td><a href="{{ host }}/{{ name }}/file/{{ child.href }}">{{ child.path }}</a></td>
-      </tr>
-      {% endfor %}
-    </tbody>
-  </table>
-{% else %}
-  <pre id="blob">
-{% for line in split(file.contents, '\n') %}
-<a href="#l{{ loop.index }}" class="line" id="l{{ loop.index }}">{{ printf("%7v", loop.index) }}</a> {{ line }}
-{% endfor %}
-{% endif %}
-  </pre>
-</div>
-{% endblock %}

templates/repo/commit.html Deleted

@@ -1,21 +0,0 @@
-{% extends "../template.html.include" %}
-
-{%- block title -%}
-{{ name }} - {{ commit.title }}
-{%- endblock -%}
-
-{% block body %}
-{% include "repo-table-header.html.include" %}
-
-<div id="content">
-  <pre><b>Commit</b> <a href="{{ host }}/{{ name }}/commit/{{ commit.id }}.html">{{ commit.id }}</a>
-<b>Parent:</b> <a href="{{ host }}/{{ name }}/commit/{{ commit.parent }}.html">{{ commit.parent }}</a>
-<b>Author:</b> {{ commit.author }} &lt;<a href="mailto:{{ commit.author_email }}">{{ commit.author_email }}</a>&gt;
-<b>Date:</b> {{ commit.authored }}
-<b>Committer:</b> {{ commit.committer }} &lt;<a href="mailto:{{ commit.committer_email }}">{{ commit.committer_email }}</a>&gt;
-<b>Committed:</b> {{ commit.committed }}
-
-{{ commit.message }}
-</pre>
-</div>
-{% endblock %}

templates/index.html Deleted

@@ -1,28 +0,0 @@
-{% extends "template.html.include" %}
-
-{%- block title -%}
-gitserve - Index
-{%- endblock -%}
-
-{% block body %}
-<table id="head">
-  <tr><td width="32px" rowspan="2"><a href="{{ host }}"><img src="{{ host }}/avatar.png" id="avatar"/></a></td>
-    <td rowspan="2"><a href="{{ host }}">{{ host }}</a> / <a href="{{ host }}">code</a></td><td class="link"><a href="{{ host }}/posts.html">posts</a></td></tr><tr><td class="link"><a href="{{ host }}/about.html">about</a></td></tr>
-</table>
-
-<hr>
-
-<div id="content">
-  <table id="index">
-    <thead>
-      <tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Last commit</b></td></tr>
-    </thead>
-
-    <tbody>
-      {% for repo in repositories %}
-      <tr><td><a href="{{ repo.name }}">{{ repo.name }}</a></td><td>{{ repo.description }}</td><td>{{ repo.updated[:16] }}</td></tr>
-      {% endfor %}
-    </tbody>
-  </table>
-</div>
-{% endblock %}

templates/docs/template.html.include Added

@@ -0,0 +1,19 @@
+{#- This is the base template used for all pages. -#}
+{#- Style credit goes to stagit. -#}
+
+<!doctype html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="x-ua-compatible" content="ie=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>{% block title %}{% endblock %}</title>
+    <link rel="stylesheet" type="text/css" href="{{ host }}/style.css"/>
+    <link rel="icon" type="image/png" href="/favicon.png"/>
+  </head>
+  <body>
+
+  {% block body %}
+  {% endblock %}
+  </body>
+</html>

templates/docs/repo/tree.html Added

@@ -0,0 +1,29 @@
+{% extends "../template.html.include" %}
+
+{%- block title -%}
+{{ name }} - target
+{%- endblock -%}
+
+{% block body %}
+{% include "repo-table-header.html.include" %}
+
+<div id="content">
+  <table id="files">
+    <thead>
+      <tr>
+        <td><b>Mode</b></td>
+        <td><b>Name</b></td>
+      </tr>
+    </thead>
+
+    <tbody>
+      {% for file in tree %}
+      <tr>
+        <td>{{ file.mode_symbolic }}</td>
+        <td><a href="{{ host }}/{{ name }}/file/{{ file.href }}">{{ file.path }}</a></td>
+      </tr>
+      {% endfor %}
+    </tbody>
+  </table>
+</div>
+{% endblock %}

templates/docs/repo/repo-table-header.html.include Added

@@ -0,0 +1,24 @@
+{#- This block is rendered at the top of every page. -#}
+
+<table id="head">
+  <tr>
+    <td width="32px" rowspan="2"><a href="{{ host }}"><img src="{{ host }}/avatar.png" id="avatar"/></a></td>
+    <td rowspan="2"><a href="{{ host }}">{{ host }}</a> / <a href="{{ host }}">code</a> / <a href="{{ host }}/{{ name }}">{{ name }}</a></td>
+    <td class="link"><a href="{{ host }}/posts.html">posts</a></td>
+  </tr>
+  <tr>
+    <td class="link"><a href="{{ host }}/about.html">about</a></td>
+  </tr>
+</table>
+<hr>
+
+<table>
+  <tr><td><span class="desc">{{ description }}</span></td></tr>
+  <tr class="url"><td>git clone <a href="{{ host }}/{{ name }}">{{ host }}/{{ name }}</a></td></tr>
+  <tr><td>
+    <a href="{{ host }}/{{ name }}/tree.html">Files</a> | <a href="{{ host }}/{{ name }}/refs.html">Refs</a>
+    {% if readme %} | <a href="{{ host }}/{{ name }}/file/{{ readme.href }}">Readme</a>{% endif %}
+    {% if license %} | <a href="{{ host }}/{{ name }}/file/{{ license.href }}">License</a>{% endif %}
+  </td></tr>
+</table>
+<hr>

templates/docs/repo/refs.html Added

@@ -0,0 +1,37 @@
+{% extends "../template.html.include" %}
+
+{%- block title -%}
+{{ name }} - Refs
+{%- endblock -%}
+
+{% block body %}
+{% include  "repo-table-header.html.include" %}
+
+<div id="content">
+  <h2>Branches</h2>
+  <table id="branches">
+    <thead>
+      <tr><td><b>Name</b></td><td colspan="2"><b>Last commit</b></td><td><b>Author</b></td></tr>
+    </thead>
+    <tbody>
+      {% for branch in branches %}
+      <tr><td>{{ branch.name }}</td><td>{{ branch.authored[:16] }}</td><td>{{ branch.title }}</td><td>{{ branch.author }}</td></tr>
+      {% endfor %}
+    </tbody>
+  </table>
+
+  <br>
+
+  <h2>Tags</h2>
+  <table id="tags">
+    <thead>
+      <tr><td><b>Name</b></td><td colspan="2"><b>Last commit</b></td><td><b>Author</b></td></tr>
+    </thead>
+    <tbody>
+      {% for tag in tags %}
+      <tr><td>{{ tag.name }}</td><td>{{ tag.authored[:16] }}</td><td>{{ tag.title }}</td><td>{{ tag.author }}</td></tr>
+      {% endfor %}
+    </tbody>
+  </table>
+</div>
+{% endblock %}

templates/docs/repo/index.html Added

@@ -0,0 +1,27 @@
+{% extends "../template.html.include" %}
+
+{%- block title -%}
+{{ description }}
+{%- endblock -%}
+
+{% block body %}
+{% include "repo-table-header.html.include" %}
+
+<div id="content">
+  <table id="log">
+    <thead>
+      <tr>
+        <td><b>Date</b></td>
+        <td><b>Commit message</b></td>
+        <td><b>Author</b></td>
+      </tr>
+    </thead>
+
+    <tbody>
+      {% for commit in commits[:50] %}
+      <tr><td>{{ commit.authored[:16] }}</td><td><a href="commit/{{ commit.id }}.html">{{ commit.title }}</a></td><td>{{ commit.author }}</td></tr>
+      {% endfor %}
+    </tbody>
+  </table>
+</div>
+{% endblock %}

templates/docs/repo/file.html Added

@@ -0,0 +1,39 @@
+{% extends "../template.html.include" %}
+
+{%- block title -%}
+{{ name }} - {{ file }}
+{%- endblock -%}
+
+{% block body %}
+{% include "repo-table-header.html.include" %}
+
+<div id="content">
+  <p>{{ file.mode_symbolic }} {{ file }}</p><hr>
+
+{% if file.is_directory %}
+  <table id="files">
+    <thead>
+      <tr>
+        <td><b>Mode</b></td>
+        <td><b>Name</b></td>
+      </tr>
+    </thead>
+
+    <tbody>
+      {% for child in file.contents %}
+      <tr>
+        <td>{{ child.mode_symbolic }}</td>
+        <td><a href="{{ host }}/{{ name }}/file/{{ child.href }}">{{ child.path }}</a></td>
+      </tr>
+      {% endfor %}
+    </tbody>
+  </table>
+{% else %}
+  <pre id="blob">
+{% for line in split(file.contents, '\n') %}
+<a href="#l{{ loop.index }}" class="line" id="l{{ loop.index }}">{{ printf("%7v", loop.index) }}</a> {{ line }}
+{% endfor %}
+{% endif %}
+  </pre>
+</div>
+{% endblock %}

templates/docs/repo/commit.html Added

@@ -0,0 +1,21 @@
+{% extends "../template.html.include" %}
+
+{%- block title -%}
+{{ name }} - {{ commit.title }}
+{%- endblock -%}
+
+{% block body %}
+{% include "repo-table-header.html.include" %}
+
+<div id="content">
+  <pre><b>Commit</b> <a href="{{ host }}/{{ name }}/commit/{{ commit.id }}.html">{{ commit.id }}</a>
+<b>Parent:</b> <a href="{{ host }}/{{ name }}/commit/{{ commit.parent }}.html">{{ commit.parent }}</a>
+<b>Author:</b> {{ commit.author }} &lt;<a href="mailto:{{ commit.author_email }}">{{ commit.author_email }}</a>&gt;
+<b>Date:</b> {{ commit.authored }}
+<b>Committer:</b> {{ commit.committer }} &lt;<a href="mailto:{{ commit.committer_email }}">{{ commit.committer_email }}</a>&gt;
+<b>Committed:</b> {{ commit.committed }}
+
+{{ commit.message }}
+</pre>
+</div>
+{% endblock %}

templates/docs/index.html Added

@@ -0,0 +1,19 @@
+{% extends "template.html.include" %}
+
+{%- block title -%}
+🐙 gitserve
+{%- endblock -%}
+
+{% block body %}
+<div id="content">
+	<h1>{{ repositories[0].name }} - {{ repositories[0].description }}</h2>
+
+	<img
+			alt="GitHub release (latest SemVer)"
+			src="https://img.shields.io/github/v/release/m-col/gitserve?color=904ff0"
+	>
+
+	TODO
+
+</div>
+{% endblock %}

templates/README.rst Added

@@ -0,0 +1,21 @@
+gitserve templates
+==================
+
+This folder contains some example templates for demonstration purposes.
+
+They can be used for generation by specifying the path of one of the folders in
+the ``gitserve`` configuration file as the ``templateDirectory``.
+
+If you make a nice template and would like to share it, contributions of more
+folders here would be very welcome!
+
+The templates and their descriptions:
+
+============= ==========================================
+Template name Description
+============= ==========================================
+docs          This is used for generating gitserve's docs website.
+stagit        This replicates much of stagit_'s style.
+============= ==========================================
+
+.. _stagit: https://codemadness.org/git/stagit

config.dhall Modified

@@ -13,7 +13,7 @@
 -- If copying, you may want to replace the relative paths for absolute paths.
 let config =
     { repoPaths = folders
-    , templateDirectory = "./templates"
+    , templateDirectory = "./templates/docs"
     , outputDirectory = "./output"
     , host = "http://localhost:8000"
     }