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

Commit b9c7afc02f303a9c56054b596e364677b7f7c012
Parent: 295e19ea90589f2b3bcb629f5eaffd0c2e5d6ecd
Author: mcol <mcol@posteo.net>
Date: 2021-11-21 18:24:08 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-11-21 18:24:08 +0000

Add full set of stagit-styled templates

templates/tree.html Modified

@@ -4,17 +4,32 @@
     <meta charset="utf-8">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>{{ name }} -- tree</title>
-    <link rel="stylesheet" href="{{- host }}/style.css" />
+    <title>{{ name }} - Tree</title>
+    <link rel="stylesheet" type="text/css" href="{{ host }}/style.css" />
+    <link rel="icon" type="image/png" href="/favicon.png" />
   </head>
 
   <body>
-    <p>{{- name }}</p>
-    <hr>
-    <p>{{- description }}</p>
-    <p>git clone {{ host }}/{{- name }}</p>
-    {% for file in tree %}
-		<p><a href="{{ host }}/{{ name }}/file/{{ file.href }}">{{- file.path }}</a></p>
-    {% endfor %}
+    {% 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>
   </body>
 </html>

templates/tags.html Deleted

@@ -1,21 +0,0 @@
-<!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>{{ name }} -- tags</title>
-    <link rel="stylesheet" href="{{- host }}/style.css" />
-  </head>
-
-  <body>
-    <p>{{ name }}</p>
-    <hr>
-    <p>{{ description }}</p>
-    <p>git clone {{ host }}/{{ name }}</p>
-    <hr>
-    {% for tag in tags %}
-		<p><b>{{ tag.name }}</b> {{ tag.id[:7] }} {{ tag.title }}</p>
-    {% endfor %}
-  </body>
-</html>

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

@@ -1,7 +1,7 @@
 <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">code</a> / <a href="{{ host }}/code/{{ name }}">{{ name }}</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>
@@ -12,12 +12,11 @@
 
 <table>
   <tr><td><span class="desc">{{ description }}</span></td></tr>
-  <tr class="url"><td>git clone <href="{{ host }}/code/{{ name }}">{{ host }}/code/{{ name }}</a></td></tr>
+  <tr class="url"><td>git clone <a href="{{ host }}/{{ name }}">{{ host }}/{{ name }}</a></td></tr>
   <tr><td>
-    <a href="tree.html">Files</a> | <a href="refs.html">Refs</a>
-    {% if readme %} | <a href="{{ readme.href }}">Readme</a></td>{% endif %}
-    %{ if license %} | <a href="{{ license.href }}">License</a>{% endif %}
+    <a href="{{ host }}/{{ name }}/tree.html">Files</a> | <a href="{{ host }}/{{ name }}/refs.html">Refs</a>
+    {% if readme %} | <a href="{{ readme.href }}">Readme</a>{% endif %}
+    {% if license %} | <a href="{{ license.href }}">License</a>{% endif %}
   </td></tr>
 </table>
 <hr>
-

templates/refs.html Modified

@@ -4,40 +4,40 @@
     <meta charset="utf-8">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
-		<title>Refs - {{ name }} - {{ description }}</title>
+    <title>Refs - {{ name }} - {{ description }}</title>
     <link rel="stylesheet" type="text/css" href="{{ host }}/style.css" />
     <link rel="icon" type="image/png" href="/favicon.png" />
   </head>
 
   <body>
-    {% include repo-table-header.html.include %}
+    {% include  "repo-table-header.html.include" %}
 
     <div id="content">
-			<h2>Branches</h2>
-			<table id="branches">
-				<thead>
-					<tr><td><b>Name</b></td><td><b>Last commit date</b></td><td><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 }}</td><td>{{ branch.title }}</td><td>{{ branch.author }}</td></tr>
-					{% endfor %}
-				</tbody>
-			</table>
+      <h2>Branches</h2>
+      <table id="branches">
+        <thead>
+          <tr><td><b>Name</b></td><td><b>Last commit date</b></td><td><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 }}</td><td>{{ branch.title }}</td><td>{{ branch.author }}</td></tr>
+          {% endfor %}
+        </tbody>
+      </table>
 
-			<br>
+      <br>
 
-			<h2>Tags</h2>
-			<table id="tags">
-				<thead>
-					<tr><td><b>Name</b></td><td><b>Last commit date</b></td><td><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 }}</td><td>{{ tag.title }}</td><td>{{ tag.author }}</td></tr>
-					{% endfor %}
-				</tbody>
-			</table>
+      <h2>Tags</h2>
+      <table id="tags">
+        <thead>
+          <tr><td><b>Name</b></td><td><b>Last commit date</b></td><td><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 }}</td><td>{{ tag.title }}</td><td>{{ tag.author }}</td></tr>
+          {% endfor %}
+        </tbody>
+      </table>
     </div>
   </body>
 </html>

templates/log.html Deleted

@@ -1,20 +0,0 @@
-<!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>{{ name }} -- log</title>
-    <link rel="stylesheet" href="{{- host }}/style.css" />
-  </head>
-
-  <body>
-    <p>{{- name }}</p>
-    <hr>
-    <p>{{- description }}</p>
-    <p>git clone {{ host }}/{{- name }}</p>
-    {% for commit in commits[:50] %}
-    <p><b><a href="{{ host }}/{{ name }}/commit/{{ commit.id }}.html">{{ commit.id[:7] }}</a></b> {{ commit.title }}</p>
-    {% endfor %}
-  </body>
-</html>

templates/index.html Modified

@@ -4,27 +4,30 @@
     <meta charset="utf-8">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>{{ name }}</title>
-    <link rel="stylesheet" href="{{- host }}/style.css" />
+    <title>{{ name }} - {{ description }}</title>
+    <link rel="stylesheet" type="text/css" href="{{ host }}/style.css" />
+    <link rel="icon" type="image/png" href="/favicon.png" />
   </head>
 
   <body>
-    <p>{{- name }}</p>
-    <hr>
-    <p>{{- description }}</p>
-    <p>git clone {{ host }}/{{- name }}</p>
-		<p><a href="./log.html">Log</a></p>
-		<p><a href="./tree.html">Tree</a></p>
-		<p><a href="./tags.html">Tags</a></p>
-		<p><a href="./branches.html">Branches</a></p>
-		{% if license %}
-		<p><a href="{{ host }}/{{ name }}/file/{{ license.href }}">License</a></p>
-		{% endif %}
-		{% if readme %}
-		<p><a href="{{ host }}/{{ name }}/file/{{ readme.href }}">Readme</a></p>
-		<pre>
-		{{ readme.contents }}
-		</pre>
-		{% endif %}
+    {% 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="commits/{{ commit.id }}.html">{{ commit.title }}</a></td><td>{{ commit.author }}</td></tr>
+          {% endfor %}
+        </tbody>
+      </table>
+    </div>
   </body>
 </html>

templates/index-main.html Modified

@@ -11,8 +11,8 @@
 
   <body>
     <table id="head">
-			<tr><td width="32px" rowspan="2"><a href="{{ host }}"><img src="/avatar.png" id="avatar"/></a></td>
-      <td rowspan="2"><a href="/">{{ host }}</a> / <a href="/code">code</a></td><td class="link"><a href="/posts.html">posts</a></td></tr><tr><td class="link"><a href="/about.html">about</a></td></tr>
+			<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>
@@ -20,8 +20,9 @@
     <div id="content">
       <table id="index">
         <thead>
-          <tr><td>Name</b></td><b>Description</b></td><td><b>Last commit</b></td></tr>
+					<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 }}</td></tr>

templates/file.html Modified

@@ -4,34 +4,44 @@
     <meta charset="utf-8">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>{{ name }} -- {{ file }}</title>
-    <link rel="stylesheet" href="{{ host }}/style.css" />
+    <title>{{ name }} - {{ file }}</title>
+    <link rel="stylesheet" type="text/css" href="{{ host }}/style.css"/>
+    <link rel="icon" type="image/png" href="/favicon.png"/>
   </head>
 
   <body>
-    <p><a href="{{ host }}">{{ host }} -- gitserve</a></p>
-    <hr>
-    <p><a href="{{ host }}/{{ name }}">{{ name }}</a></p>
-    <p>{{ description }}</p>
-    <hr>
-    <p>{{ file.mode }} <b>{{ file.path }}</b></p>
-    <hr>
+    {% include "repo-table-header.html.include" %}
+
+    <div id="content">
+      <p>{{ file }} {{ file.mode_symbolic }}</p>
+
+      <hr>
 
 {% if file.is_directory %}
-    <table>
-{% for item in file.contents %}
-      <tr><a href="{{ host }}/{{ name }}/file/{{ file }}.{{ item }}.html">{{ item }}</a></tr>
-{% endfor %}
-    </table>
+      <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>
+      <pre id="blob">
 {% for line in split(file.contents, '\n') %}
-<a href="#l{{ loop.index }}" id="l{{ loop.index }}">{{ printf("%7v", loop.index) }}</a> {{ line }}
+<a href="#l{{ loop.index }}" class="line" id="l{{ loop.index }}">{{ printf("%7v", loop.index) }}</a> {{ line }}
 {% endfor %}
-</pre>
 {% endif %}
-
-    <hr>
+      </pre>
+    </div>
   </body>
 </html>

templates/commit.html Modified

@@ -4,19 +4,23 @@
     <meta charset="utf-8">
     <meta http-equiv="x-ua-compatible" content="ie=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
-		<title>{{ name }} -- {{ commit.id[:7] }}</title>
-    <link rel="stylesheet" href="{{- host }}/style.css" />
+    <title>{{ name }} - {{ commit.title }}</title>
+    <link rel="stylesheet" type="text/css" href="{{ host }}/style.css" />
+    <link rel="icon" type="image/png" href="/favicon.png" />
   </head>
 
   <body>
-    <p>{{- name }}</p>
-    <hr>
-		<p>Commit <b>{{ commit.id }}</b></p>
-		<p><b>{{ commit.title }}</b></p>
-    <p>{{ commit.body }}</p>
-    <hr>
-		<p>Authored {{ commit.authored }} by: {{ commit.author }} ({{ commit.author_email }})</p>
-		<p>Committed {{ commit.committed }} by: {{ commit.committer }} ({{ commit.committer_email }})</p>
-    <hr>
+    {% include "repo-table-header.html.include" %}
+
+    <div id="content">
+      <pre><b>commit</b> <a href="{{ host }}/{{ name }}/commits/{{ commit.href }}">{{ commit.id }}</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>
   </body>
 </html>

templates/branches.html Deleted

@@ -1,21 +0,0 @@
-<!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>{{ name }} -- tags</title>
-    <link rel="stylesheet" href="{{- host }}/style.css" />
-  </head>
-
-  <body>
-    <p>{{ name }}</p>
-    <hr>
-    <p>{{ description }}</p>
-    <p>git clone {{ host }}/{{ name }}</p>
-    <hr>
-    {% for branch in branches %}
-		<p><b>{{ branch.name }}</b> {{ branch.id[:7] }} {{ branch.title }}</p>
-    {% endfor %}
-  </body>
-</html>

config.dhall Modified

@@ -18,7 +18,7 @@
     , commitTemplate = "./templates/commit.html"
     , fileTemplate = "./templates/file.html"
     , outputDirectory = "./output"
-    , host = "http://localhost"
+    , host = "http://localhost:8000"
     }
 
 in config