This commit is contained in:
Mirek Kratochvil 2023-05-27 21:00:21 +02:00
parent 31f54f94ba
commit adb4ffd5d5

View file

@ -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.