on master help sign in
Documented Text.Hakyll.Renderables.
0bbb99eJasper Van der Jeugt
src/Text/Hakyll/Renderables.hs+13−7
@@ -13,14 +13,17 @@ import Text.Hakyll.Util
13import Text.Hakyll.Page
13import Text.Hakyll.Page
14import Text.Hakyll.Renderable
14import Text.Hakyll.Renderable
15
15
16+-- | A custom page.
16−data CustomPage = CustomPage { url :: String,
17+data CustomPage = CustomPage
18+ { url :: String,
17− dependencies :: [FilePath],
19+ dependencies :: [FilePath],
18− mapping :: [(String, Either String (IO B.ByteString))]
20+ mapping :: [(String, Either String (IO B.ByteString))]
19− }
21+ }
20
22
23+-- | Create a custom page.
21−createCustomPage :: String
24+createCustomPage :: String -- ^ Destination of the page, relative to _site.
22− -> [FilePath]
25+ -> [FilePath] -- ^ Dependencies of the page.
23− -> [(String, Either String (IO B.ByteString))]
26+ -> [(String, Either String (IO B.ByteString))] -- ^ Key - value mapping for rendering.
24 -> CustomPage
27 -> CustomPage
25createCustomPage = CustomPage
28createCustomPage = CustomPage
26
29
@@ -32,8 +35,11 @@ instance Renderable CustomPage where
32 let keys = map (B.pack . fst) (mapping page)
35 let keys = map (B.pack . fst) (mapping page)
33 return $ M.fromList $ (B.pack "url", B.pack $ url page) : zip keys values
36 return $ M.fromList $ (B.pack "url", B.pack $ url page) : zip keys values
34
37
38+-- | PagePath is a class that wraps a FilePath. This is used to render Pages
39+-- without reading them first through use of caching.
35data PagePath = PagePath FilePath
40data PagePath = PagePath FilePath
36
41
42+-- | Create a PagePath from a FilePath.
37createPagePath :: FilePath -> PagePath
43createPagePath :: FilePath -> PagePath
38createPagePath = PagePath
44createPagePath = PagePath
39
45