aboutsummaryrefslogtreecommitdiff
path: root/site.hs
diff options
context:
space:
mode:
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.