summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web/Page.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-30 21:18:55 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-12-30 21:18:55 +0100
commite49cd3b4b071c2e0cb3e553fe8272e7cd2843349 (patch)
tree544d8f29ca8082577426010b7f251185a209e3f4 /src/Hakyll/Web/Page.hs
parentda12825066d16884bae2f884029102919dd9a558 (diff)
downloadhakyll-e49cd3b4b071c2e0cb3e553fe8272e7cd2843349.tar.gz
Cleanup, split up page module
Diffstat (limited to 'src/Hakyll/Web/Page.hs')
-rw-r--r--src/Hakyll/Web/Page.hs31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/Hakyll/Web/Page.hs b/src/Hakyll/Web/Page.hs
index 78178cb..eea474c 100644
--- a/src/Hakyll/Web/Page.hs
+++ b/src/Hakyll/Web/Page.hs
@@ -6,35 +6,24 @@
module Hakyll.Web.Page
( Page (..)
, toMap
+ , pageRead
) where
-import Control.Applicative ((<$>), (<*>))
+import Control.Arrow ((>>^))
import Data.Map (Map)
import qualified Data.Map as M
-import Data.Binary (Binary, get, put)
-import Data.Typeable (Typeable)
-import Hakyll.Core.Writable
-
--- | Type used to represent pages
---
-data Page a = Page
- { pageMetadata :: Map String String
- , pageBody :: a
- } deriving (Show, Typeable)
-
-instance Functor Page where
- fmap f (Page m b) = Page m (f b)
-
-instance Binary a => Binary (Page a) where
- put (Page m b) = put m >> put b
- get = Page <$> get <*> get
-
-instance Writable a => Writable (Page a) where
- write p (Page _ b) = write p b
+import Hakyll.Core.Compiler
+import Hakyll.Web.Page.Internal
+import Hakyll.Web.Page.Read
-- | Convert a page to a map. The body will be placed in the @body@ key.
--
toMap :: Page String -> Map String String
toMap (Page m b) = M.insert "body" b m
+
+-- | Read a page (do not render it)
+--
+pageRead :: Compiler a (Page String)
+pageRead = getResourceString >>^ readPage