on master help sign in
Moved writePage to Text.Hakyll.Page.
commita18789a6fbc1cff2a3828a626769cc96a8526026 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateSun 13 Dec 2009, 10:15 (17 years ago) parent5d64ff7
2 files changed+9−9
src/Text/Hakyll/Page.hs+9−1 src/Text/Hakyll/Render.hs−8
src/Text/Hakyll/Page.hs+9−1
@@ -2,7 +2,8 @@ module Text.Hakyll.Page
22 ( Page,
33 fromContext,
44 getBody,
5− readPage
5+ readPage,
6+ writePage
67 ) where
78
89import qualified Data.Map as M
@@ -116,6 +117,13 @@ readPage pagePath = do
116117 where url = toURL pagePath
117118 cacheFile = toCache url
118119
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+
119127-- Make pages renderable.
120128instance Renderable Page where
121129 getDependencies = (:[]) . flip addExtension ".html" . dropExtension . getPageURL
src/Text/Hakyll/Render.hs−8
@@ -1,6 +1,5 @@
11module Text.Hakyll.Render
22 ( depends,
3− writePage,
43 render,
54 renderAndConcat,
65 renderChain,
@@ -29,13 +28,6 @@ depends file dependencies action = do
2928 valid <- isCacheValid (toDestination file) dependencies
3029 unless valid action
3130
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−
3931-- | Render to a Page.
4032render :: Renderable a
4133 => FilePath -- ^ Template to use for rendering.