diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-10-28 13:32:34 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-10-28 13:32:34 +0200 |
commit | 6b44cef123af6426a55838707586b6ac95f9db8b (patch) | |
tree | 40cadd8818bcdff1cc2650e489103d7a84041532 /src/Text/Hakyll/ContextManipulations.hs | |
parent | 1f169dd0a0132464e74400e3c5625e8a30658a4c (diff) | |
download | hakyll-6b44cef123af6426a55838707586b6ac95f9db8b.tar.gz |
Add a takeBody function
Diffstat (limited to 'src/Text/Hakyll/ContextManipulations.hs')
-rw-r--r-- | src/Text/Hakyll/ContextManipulations.hs | 6 |
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 |