@@ -1,4 +1,12 @@
1−module Text.Hakyll.Page where
1+module Text.Hakyll.Page
2+ ( Page,
3+ addContext,
4+ getURL,
5+ getBody,
6+ readPage,
7+ pageFromList,
8+ concatPages
9+ ) where
210
311import qualified Data.Map as M
412import qualified Data.List as L
@@ -18,7 +26,7 @@ getBody :: Page -> String
1826getBody context = fromMaybe "" $ M.lookup "body" context
1927
2028readConfig :: [String] -> Page
21−readConfig lines = M.fromList $ map (trim . break (== ':')) lines
29+readConfig = M.fromList . map (trim . break (== ':'))
2230 where trim (key, value) = (key, dropWhile (`elem` ": ") value)
2331
2432extractContext :: String -> Page
@@ -45,3 +53,8 @@ readPage path = do
4553 url = addExtension (dropExtension path) ".html"
4654 return $ addContext "url" url $ addContext "body" body $ context
4755
56+pageFromList :: [(String, String)] -> Page
57+pageFromList = M.fromList
58+
59+concatPages :: [Page] -> String
60+concatPages = concat . map getBody