cmts
This commit is contained in:
parent
31f54f94ba
commit
adb4ffd5d5
5
site.hs
5
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.
|
||||
|
|
Loading…
Reference in a new issue