From adb4ffd5d523edef6dded11466632d051a214007 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sat, 27 May 2023 21:00:21 +0200 Subject: [PATCH] cmts --- site.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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.