aboutsummaryrefslogtreecommitdiff
path: root/site.hs
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-05-27 21:00:21 +0200
committerMirek Kratochvil <exa.exa@gmail.com>2023-05-27 21:00:21 +0200
commitadb4ffd5d523edef6dded11466632d051a214007 (patch)
tree46bbd0fb27deefeee67398a1e814e54cf1c1640d /site.hs
parent31f54f94bad4623f21c9aa62a073d2d79c106eaf (diff)
downloadreploy-adb4ffd5d523edef6dded11466632d051a214007.tar.gz
reploy-adb4ffd5d523edef6dded11466632d051a214007.tar.bz2
cmts
Diffstat (limited to 'site.hs')
-rw-r--r--site.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/site.hs b/site.hs
index 800c37e..985ce23 100644
--- a/site.hs
+++ b/site.hs
@@ -82,6 +82,7 @@ pageTemplates = do
nub . ([rt, tt] ++) <$>
(gets (^.. pages . traverse) >>= traverse pageTemplate)
+-- | Compile a single template in a directory
compileTemplate ::
FilePath
-> FilePath
@@ -127,6 +128,7 @@ processLink base l = do
pageFilename :: FilePath -> Site FilePath
pageFilename p = indexFilename $ "page" </> p
+-- | Like `Mu.substitute` but writes and throws stuff on errors
checkedSubstitute :: Mu.Template -> Y.Value -> IO T.Text
checkedSubstitute t v = do
let (es, txt) = Mu.checkedSubstitute t v
@@ -161,7 +163,8 @@ installRedirect target from = do
io $ do
putStrLn $ "@ -> " ++ file ++ " -> " ++ target
makeDirectories file
- txt <- checkedSubstitute templ $ Y.object [("target", Y.String $ T.pack target)]
+ txt <-
+ checkedSubstitute templ $ Y.object [("target", Y.String $ T.pack target)]
TIO.writeFile file txt
-- | Install all redirects required by one page.