on master help sign in
Moved writePage to Text.Hakyll.Page.
a18789aJasper Van der Jeugt
src/Text/Hakyll/Page.hs+9−1
@@ -2,7 +2,8 @@ module Text.Hakyll.Page
2 ( Page,
2 ( Page,
3 fromContext,
3 fromContext,
4 getBody,
4 getBody,
5− readPage
5+ readPage,
6+ writePage
6 ) where
7 ) where
7
8
8import qualified Data.Map as M
9import qualified Data.Map as M
@@ -116,6 +117,13 @@ readPage pagePath = do
116 where url = toURL pagePath
117 where url = toURL pagePath
117 cacheFile = toCache url
118 cacheFile = toCache url
118
119
120+-- | Write a page to the site destination.
121+writePage :: Page -> IO ()
122+writePage page = do
123+ let destination = toDestination $ getURL page
124+ makeDirectories destination
125+ B.writeFile destination (getBody page)
126+
119-- Make pages renderable.
127-- Make pages renderable.
120instance Renderable Page where
128instance Renderable Page where
121 getDependencies = (:[]) . flip addExtension ".html" . dropExtension . getPageURL
129 getDependencies = (:[]) . flip addExtension ".html" . dropExtension . getPageURL
src/Text/Hakyll/Render.hs−8
@@ -1,6 +1,5 @@
1module Text.Hakyll.Render
1module Text.Hakyll.Render
2 ( depends,
2 ( depends,
3− writePage,
4 render,
3 render,
5 renderAndConcat,
4 renderAndConcat,
6 renderChain,
5 renderChain,
@@ -29,13 +28,6 @@ depends file dependencies action = do
29 valid <- isCacheValid (toDestination file) dependencies
28 valid <- isCacheValid (toDestination file) dependencies
30 unless valid action
29 unless valid action
31
30
32−-- | Write a page to the site destination.
33−writePage :: Page -> IO ()
34−writePage page = do
35− let destination = toDestination $ getURL page
36− makeDirectories destination
37− B.writeFile destination (getBody page)
38−
39-- | Render to a Page.
31-- | Render to a Page.
40render :: Renderable a
32render :: Renderable a
41 => FilePath -- ^ Template to use for rendering.
33 => FilePath -- ^ Template to use for rendering.