From 76cfb5395896d7f2534863081d62dc016470b6e7 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Wed, 29 Oct 2014 10:47:22 +0100 Subject: Add listFieldWith --- src/Hakyll/Web/Template/Context.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Hakyll/Web/Template/Context.hs b/src/Hakyll/Web/Template/Context.hs index b5066a6..2da76d4 100644 --- a/src/Hakyll/Web/Template/Context.hs +++ b/src/Hakyll/Web/Template/Context.hs @@ -6,6 +6,7 @@ module Hakyll.Web.Template.Context , field , constField , listField + , listFieldWith , functionField , mapContext @@ -104,7 +105,13 @@ constField key = field key . const . return -------------------------------------------------------------------------------- listField :: String -> Context a -> Compiler [Item a] -> Context b -listField key c xs = field' key $ \_ -> fmap (ListField c) xs +listField key c xs = listFieldWith key c (const xs) + + +-------------------------------------------------------------------------------- +listFieldWith + :: String -> Context a -> (Item b -> Compiler [Item a]) -> Context b +listFieldWith key c f = field' key $ fmap (ListField c) . f -------------------------------------------------------------------------------- -- cgit v1.2.3