summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/ContextManipulations.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-10-28 13:32:34 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-10-28 13:32:34 +0200
commit6b44cef123af6426a55838707586b6ac95f9db8b (patch)
tree40cadd8818bcdff1cc2650e489103d7a84041532 /src/Text/Hakyll/ContextManipulations.hs
parent1f169dd0a0132464e74400e3c5625e8a30658a4c (diff)
downloadhakyll-6b44cef123af6426a55838707586b6ac95f9db8b.tar.gz
Add a takeBody function
Diffstat (limited to 'src/Text/Hakyll/ContextManipulations.hs')
-rw-r--r--src/Text/Hakyll/ContextManipulations.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Text/Hakyll/ContextManipulations.hs b/src/Text/Hakyll/ContextManipulations.hs
index 2ececc6..46ee5ed 100644
--- a/src/Text/Hakyll/ContextManipulations.hs
+++ b/src/Text/Hakyll/ContextManipulations.hs
@@ -9,6 +9,7 @@ module Text.Hakyll.ContextManipulations
, renderDateWithLocale
, changeExtension
, renderBody
+ , takeBody
) where
import Control.Monad (liftM)
@@ -115,3 +116,8 @@ changeExtension extension = changeValue "url" changeExtension'
renderBody :: (String -> String)
-> HakyllAction Context Context
renderBody = renderValue "body" "body"
+
+-- | Get the resulting body text from a context
+--
+takeBody :: HakyllAction Context String
+takeBody = arr $ fromMaybe "" . M.lookup "body" . unContext