From 6b44cef123af6426a55838707586b6ac95f9db8b Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Thu, 28 Oct 2010 13:32:34 +0200 Subject: Add a takeBody function --- src/Text/Hakyll/ContextManipulations.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Text/Hakyll/ContextManipulations.hs') 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 -- cgit v1.2.3