diff options
-rw-r--r-- | hakyll.cabal | 3 | ||||
-rw-r--r-- | src/Text/Hakyll/RenderableFilePath.hs | 16 | ||||
-rw-r--r-- | src/Text/Hakyll/Renderables.hs (renamed from src/Text/Hakyll/CustomPage.hs) | 19 |
3 files changed, 18 insertions, 20 deletions
diff --git a/hakyll.cabal b/hakyll.cabal index 4aa8ca3..26f80d5 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -22,7 +22,6 @@ library pandoc >= 1 exposed-modules: Text.Hakyll.Render Text.Hakyll.Renderable + Text.Hakyll.Renderables Text.Hakyll.Page - Text.Hakyll.CustomPage - Text.Hakyll.RenderableFilePath Text.Hakyll.Util 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 |