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

Commit 184aa13862e1ff69490695beadfd77a9fb32bf00
Parent: 577b81cc825d587456c0f6cdc73a96bf6c40c8f0
Author: mcol <mcol@posteo.net>
Date: 2021-09-24 12:50:25 +0100
Committer: mcol <mcol@posteo.net>
Committed: 2021-09-24 12:50:25 +0100

Add commit.title and commit.body properties

templates/log.html Modified

@@ -14,7 +14,7 @@
     <p>{{- description }}</p>
     <p>git clone {{ host }}/{{- name }}</p>
     {% for commit in commits %}
-    <p>{{- commit.message }}</p>
+    <p>{{- commit.title }}</p>
     {% endfor %}
   </body>
 </html>

src/Repositories.hs Modified

@@ -15,7 +15,7 @@
 import Data.Default (def)
 import Data.Either (fromRight)
 import Data.Tagged
-import Data.Text (pack, Text, strip)
+import Data.Text (pack, Text, strip, breakOn)
 import Data.Maybe (mapMaybe)
 import Git
 import Git.Libgit2 (lgFactory, LgRepo)
@@ -129,5 +129,7 @@
 
 commitAsLookup :: Commit LgRepo -> Text -> Maybe (GVal m)
 commitAsLookup commit = \case
+    "title" -> Just . toGVal . strip . fst . breakOn "\n" . commitLog $ commit
+    "body" -> Just . toGVal . strip . snd . breakOn "\n" . commitLog $ commit
     "message" -> Just . toGVal . strip . commitLog $ commit
     _ -> Nothing