Add Hakyll.Web module

This commit is contained in:
Jasper Van der Jeugt 2010-12-31 16:15:57 +01:00
parent e54834f444
commit e1aa960099
2 changed files with 22 additions and 1 deletions

21
src/Hakyll/Web.hs Normal file
View file

@ -0,0 +1,21 @@
-- | Module exporting commonly used web-related functions
--
module Hakyll.Web
( defaultPageRead
, defaultTemplateRead
) where
import Control.Arrow (arr, (>>>), (>>^))
import Hakyll.Core.Compiler
import Hakyll.Web.Page
import Hakyll.Web.Pandoc
import Hakyll.Web.Template
defaultPageRead :: Compiler () (Page String)
defaultPageRead = cached "Hakyll.Web.defaultPageRead" $
pageRead >>> addDefaultFields >>> arr applySelf >>> pageRenderPandoc
defaultTemplateRead :: Compiler () Template
defaultTemplateRead = cached "Hakyll.Web.defaultTemplateRead" $
getResourceString >>^ readTemplate

View file

@ -61,6 +61,6 @@ addDefaultFields = (getRoute &&& id >>^ uncurry addRoute)
-- Add title and category, based on identifier
addIdentifier i = addField "title" (takeBaseName p)
. addField "category" (takeBaseName $ takeDirectory p)
. addField "category" (takeBaseName $ takeDirectory p)
where
p = toFilePath i