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

Commit aa3f79e455c68bccdfddfa180ada0ce81b2cba61
Parent: 80d89e61460f5cdd6fb89f889d8e37c3c4451b80
Author: mcol <mcol@posteo.net>
Date: 2021-09-24 00:15:32 +0100
Committer: mcol <mcol@posteo.net>
Committed: 2021-09-24 00:15:32 +0100

Add docstring to `package`

src/Repositories.hs Modified

@@ -70,6 +70,23 @@
     name = takeFileName path
     outPath = directory </> name
 
+{-
+The role of the function above is to gather information about a git repository and
+package it all together in such a way that various parts can be accessed and used by
+Ginger templates. `package` takes these pieces of information and places it all into a
+hashmap which Ginger can use to look up variables.
+-}
+package
+    :: Text
+    -> [Commit LgRepo]
+    -> [(TreeFilePath, TreeEntry r)]
+    -> HashMap.HashMap Text Text
+package description commits tree = HashMap.fromList
+    [ ("commits", "commits")
+    , ("description", description)
+    , ("tree", "tree")
+    ]
+
 getCommits :: CommitOid LgRepo -> ReaderT LgRepo IO [Commit LgRepo]
 getCommits commitID =
     sequence . mapMaybe loadCommit <=<
@@ -84,14 +101,3 @@
 
 getDescription :: FilePath -> IO Text
 getDescription path = fromRight "" <$> tryIOError (pack <$> readFile path)
-
-package
-    :: Text
-    -> [Commit LgRepo]
-    -> [(TreeFilePath, TreeEntry r)]
-    -> HashMap.HashMap Text Text
-package description commits tree = HashMap.fromList
-    [ ("commits", "commits")
-    , ("description", description)
-    , ("tree", "tree")
-    ]