summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2014-01-14 07:33:44 -0800
committerJasper Van der Jeugt <jaspervdj@gmail.com>2014-01-14 07:33:44 -0800
commita37f8aedb441f01b9c2c16fb8a079a6e6f6485a1 (patch)
tree171e39910311432f4d172c68e1d75061345e5be7 /src/Hakyll/Web
parent1b1694d4bdb589bd33b4a30fb946f582021ccafb (diff)
parent52d49c43604a81097fbb799775252429f3f73b42 (diff)
downloadhakyll-a37f8aedb441f01b9c2c16fb8a079a6e6f6485a1.tar.gz
Merge pull request #207 from co-dan/docpatches
More haddocks for Hakyll.Web.Template.Context
Diffstat (limited to 'src/Hakyll/Web')
-rw-r--r--src/Hakyll/Web/Template/Context.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Hakyll/Web/Template/Context.hs b/src/Hakyll/Web/Template/Context.hs
index 80458ee..a741272 100644
--- a/src/Hakyll/Web/Template/Context.hs
+++ b/src/Hakyll/Web/Template/Context.hs
@@ -87,11 +87,16 @@ field' key value = Context $ \k i -> if k == key then value i else empty
--------------------------------------------------------------------------------
-field :: String -> (Item a -> Compiler String) -> Context a
+-- | Constructs a new field in the 'Context.'
+field :: String -- ^ Key
+ -> (Item a -> Compiler String) -- ^ Function that constructs a
+ -- value based on the item
+ -> Context a
field key value = field' key (fmap StringField . value)
--------------------------------------------------------------------------------
+-- | Creates a 'field' that does not depend on the 'Item'
constField :: String -> String -> Context a
constField key = field key . const . return
@@ -149,6 +154,7 @@ teaserSeparator = "<!--more-->"
--------------------------------------------------------------------------------
+-- | Constructs a 'field' that contains the body of the item.
bodyField :: String -> Context String
bodyField key = field key $ return . itemBody
@@ -175,7 +181,7 @@ pathField key = field key $ return . toFilePath . itemIdentifier
--------------------------------------------------------------------------------
--- | This title field takes the basename of the underlying file by default
+-- | This title 'field' takes the basename of the underlying file by default
titleField :: String -> Context a
titleField = mapContext takeBaseName . pathField