summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/ContextManipulations.hs
diff options
context:
space:
mode:
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