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

Commit 89f0b82c2b06a7ffa5865a78b99aa1f96f3d7660
Parent: 0a18f38bb5c398bd192a6268281fc6abefaedd63
Author: mcol <mcol@posteo.net>
Date: 2021-11-21 17:39:15 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-11-21 17:39:15 +0000

Remove comment on ginger includeResolver about caching

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

@@ -0,0 +1,23 @@
+<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 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 <href="{{ host }}/code/{{ name }}">{{ host }}/code/{{ 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 %}
+  </td></tr>
+</table>
+<hr>
+

templates/refs.html Added

@@ -0,0 +1,43 @@
+<!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>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 %}
+
+    <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>
+
+			<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>
+    </div>
+  </body>
+</html>

templates/index-main.html Modified

@@ -4,16 +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>gitserve</title>
-    <link rel="stylesheet" href="{{- host }}/style.css" />
+    <title>{{ host }} / code</title>
+    <link rel="stylesheet" type="text/css" href="{{ host }}/style.css" />
+    <link rel="icon" type="image/png" href="/favicon.png" />
   </head>
 
   <body>
-    <p>gitserve</p>
+    <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>
+    </table>
+
     <hr>
-		<p>My git repositories - {{ host }}</p>
-    {% for repo in repositories %}
-		<p><a href="{{- host }}/{{- repo.name }}">{{- repo.name }}</a> -- {{ repo.description }}</p>
-    {% endfor %}
+
+    <div id="content">
+      <table id="index">
+        <thead>
+          <tr><td>Name</b></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>
+          {% endfor %}
+        </tbody>
+      </table>
+    </div>
   </body>
 </html>

src/Templates.hs Modified

@@ -107,8 +107,7 @@
             return Nothing
 
 {-
-This is a Ginger `IncludeResolver` that will eventually be extended to enable caching of
-includes.
+This resolves Ginger's template includes.
 -}
 includeResolver :: FilePath -> IO (Maybe String)
 includeResolver path = either (const Nothing) Just <$> tryIOError (readFile path)