diff options
-rw-r--r-- | src/Hakyll/Web/Template/Context.hs | 9 |
1 files changed, 8 insertions, 1 deletions
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 -------------------------------------------------------------------------------- |