summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-12 14:48:36 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-12 14:48:36 +0100
commit333c19d0c1d88ea35e3e811c2100b514ffe738c1 (patch)
treeb9acb39c0f6455700682e1684028e41cf85979a5 /src/Text/Hakyll
parentd988921714f3335b9755e30ea893e3e2b47d72b6 (diff)
downloadhakyll-333c19d0c1d88ea35e3e811c2100b514ffe738c1.tar.gz
Merged CustomPage and RenderableFilePath into one file.
Diffstat (limited to 'src/Text/Hakyll')
-rw-r--r--src/Text/Hakyll/RenderableFilePath.hs16
-rw-r--r--src/Text/Hakyll/Renderables.hs (renamed from src/Text/Hakyll/CustomPage.hs)19
2 files changed, 17 insertions, 18 deletions
diff --git a/src/Text/Hakyll/RenderableFilePath.hs b/src/Text/Hakyll/RenderableFilePath.hs
deleted file mode 100644
index f729a11..0000000
--- a/src/Text/Hakyll/RenderableFilePath.hs
+++ /dev/null
@@ -1,16 +0,0 @@
-module Text.Hakyll.RenderableFilePath
- ( RenderableFilePath (..)
- ) where
-
-import System.FilePath
-import Text.Hakyll.Renderable
-import Text.Hakyll.Util
-import Text.Hakyll.Page
-
-newtype RenderableFilePath = RenderableFilePath FilePath
-
--- We can render filepaths
-instance Renderable RenderableFilePath where
- getDependencies (RenderableFilePath path) = return path
- getURL (RenderableFilePath path) = toURL path
- toContext (RenderableFilePath path) = readPage path >>= toContext
diff --git a/src/Text/Hakyll/CustomPage.hs b/src/Text/Hakyll/Renderables.hs
index c18bb2d..17b987d 100644
--- a/src/Text/Hakyll/CustomPage.hs
+++ b/src/Text/Hakyll/Renderables.hs
@@ -1,12 +1,16 @@
-module Text.Hakyll.CustomPage
+module Text.Hakyll.Renderables
( CustomPage,
- createCustomPage
+ createCustomPage,
+ PagePath,
+ createPagePath
) where
import System.FilePath
import qualified Data.ByteString.Lazy.Char8 as B
import qualified Data.Map as M
import Control.Monad
+import Text.Hakyll.Util
+import Text.Hakyll.Page
import Text.Hakyll.Renderable
data CustomPage = CustomPage { url :: String,
@@ -27,3 +31,14 @@ instance Renderable CustomPage where
values <- mapM (either (return . B.pack) (>>= return) . snd) (mapping page)
let keys = map (B.pack . fst) (mapping page)
return $ M.fromList $ (B.pack "url", B.pack $ url page) : zip keys values
+
+data PagePath = PagePath FilePath
+
+createPagePath :: FilePath -> PagePath
+createPagePath = PagePath
+
+-- We can render filepaths
+instance Renderable PagePath where
+ getDependencies (PagePath path) = return path
+ getURL (PagePath path) = toURL path
+ toContext (PagePath path) = readPage path >>= toContext