1module Text.Hakyll.Renderables
8import System.FilePath (FilePath)
9import qualified Data.ByteString.Lazy.Char8 as B
10import qualified Data.Map as M
11import Text.Hakyll.Page
12import Text.Hakyll.Renderable
13import Text.Hakyll.File
16data CustomPage = CustomPage
18 dependencies :: [FilePath],
19 mapping :: [(String, Either String (IO B.ByteString))]
22-- | Create a custom page.
23createCustomPage :: String -- ^ Destination of the page, relative to _site.
24 -> [FilePath] -- ^ Dependencies of the page.
25 -> [(String, Either String (IO B.ByteString))] -- ^ Key - value mapping for rendering.
27createCustomPage = CustomPage
29instance Renderable CustomPage where
30 getDependencies = dependencies
33 values <- mapM (either (return . B.pack) (>>= return) . snd) (mapping page)
34 let keys = map (B.pack . fst) (mapping page)
35 return $ M.fromList $ (B.pack "url", B.pack $ url page) : zip keys values
37-- | PagePath is a class that wraps a FilePath. This is used to render Pages
38-- without reading them first through use of caching.
39data PagePath = PagePath FilePath
41-- | Create a PagePath from a FilePath.
42createPagePath :: FilePath -> PagePath
43createPagePath = PagePath
45-- We can render filepaths
46instance Renderable PagePath where
47 getDependencies (PagePath path) = return path
48 getURL (PagePath path) = toURL path
49 toContext (PagePath path) = readPage path >>= toContext
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list