diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-13 10:09:10 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-13 10:09:10 +0100 |
commit | 5d64ff7d5c9735ea17638e5b66dba0a44a0308db (patch) | |
tree | 3cc5cfb6060e1a9a81ef16f905d83de608b0b883 /src | |
parent | 0bbb99ed2fd592d60496e2af5d2ed401ab06697c (diff) | |
download | hakyll-5d64ff7d5c9735ea17638e5b66dba0a44a0308db.tar.gz |
Removed some deprecated functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Hakyll/Page.hs | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/Text/Hakyll/Page.hs b/src/Text/Hakyll/Page.hs index f106303..4bcacc4 100644 --- a/src/Text/Hakyll/Page.hs +++ b/src/Text/Hakyll/Page.hs @@ -1,10 +1,8 @@ module Text.Hakyll.Page ( Page, fromContext, - addContext, getBody, - readPage, - pageFromList + readPage ) where import qualified Data.Map as M @@ -28,10 +26,6 @@ data Page = Page (M.Map B.ByteString B.ByteString) fromContext :: (M.Map B.ByteString B.ByteString) -> Page fromContext = Page --- | Add a key-value mapping to the Page. -addContext :: String -> String -> Page -> Page -addContext key value (Page page) = Page $ M.insert (B.pack key) (B.pack value) page - -- | Auxiliary function to pack a pair. packPair :: (String, String) -> (B.ByteString, B.ByteString) packPair (a, b) = (B.pack a, B.pack b) @@ -113,7 +107,8 @@ readPage pagePath = do -- Render file let rendered = B.pack $ (renderFunction $ takeExtension path) body seq rendered $ hClose handle - let page = addContext "url" url $ Page $ M.fromList $ (B.pack "body", rendered) : map packPair context + let page = fromContext $ M.fromList $ + [(B.pack "body", rendered), packPair ("url", url)] ++ map packPair context -- Cache if needed if getFromCache then return () else cachePage page @@ -121,10 +116,6 @@ readPage pagePath = do where url = toURL pagePath cacheFile = toCache url --- | Create a key-value mapping page from an association list. -pageFromList :: [(String, String)] -> Page -pageFromList = Page . M.fromList . map packPair - -- Make pages renderable. instance Renderable Page where getDependencies = (:[]) . flip addExtension ".html" . dropExtension . getPageURL |