on master help sign in
Add listFieldWith
commit76cfb5395896d7f2534863081d62dc016470b6e7 authorJasper Van der Jeugt <m@jaspervdj.be> dateWed 29 Oct 2014, 10:47 (12 years ago) parent3c15d0f
1 file changed+8−1
src/Hakyll/Web/Template/Context.hs+8−1
src/Hakyll/Web/Template/Context.hs+8−1
@@ -6,6 +6,7 @@ module Hakyll.Web.Template.Context
66 , field
77 , constField
88 , listField
9+ , listFieldWith
910 , functionField
1011 , mapContext
1112
@@ -104,7 +105,13 @@ constField key = field key . const . return
104105
105106--------------------------------------------------------------------------------
106107listField :: String -> Context a -> Compiler [Item a] -> Context b
107−listField key c xs = field' key $ \_ -> fmap (ListField c) xs
108+listField key c xs = listFieldWith key c (const xs)
109+
110+
111+--------------------------------------------------------------------------------
112+listFieldWith
113+ :: String -> Context a -> (Item b -> Compiler [Item a]) -> Context b
114+listFieldWith key c f = field' key $ fmap (ListField c) . f
108115
109116
110117--------------------------------------------------------------------------------