summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll
diff options
context:
space:
mode:
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