diff options
| author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-13 17:31:03 +0100 |
|---|---|---|
| committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-13 17:31:03 +0100 |
| commit | f0af2a3b79ea7eea3f521f79fd903f9023ec85df (patch) | |
| tree | bbc460b65ab52879c616dffce1bb32fe8d8df2ac /src/Hakyll/Web/Template | |
| parent | d2e913f42434841c584b97ae9d5417ff2737c0ce (diff) | |
| download | hakyll-f0af2a3b79ea7eea3f521f79fd903f9023ec85df.tar.gz | |
WIP
Diffstat (limited to 'src/Hakyll/Web/Template')
| -rw-r--r-- | src/Hakyll/Web/Template/Context.hs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Hakyll/Web/Template/Context.hs b/src/Hakyll/Web/Template/Context.hs index 4273b79..6261a09 100644 --- a/src/Hakyll/Web/Template/Context.hs +++ b/src/Hakyll/Web/Template/Context.hs @@ -26,16 +26,14 @@ import Hakyll.Web.Urls -------------------------------------------------------------------------------- -type Context a = Compiler (String, (Identifier a, a)) String +type Context a = String -> Identifier -> a -> Compiler String -------------------------------------------------------------------------------- -field :: String -> Compiler (Identifier a, a) String -> Context a -field key value = arr checkKey >>> (empty ||| value) - where - checkKey (k, x) - | k /= key = Left () - | otherwise = Right x +field :: String -> (Identifier -> a -> Compiler String) -> Context a +field key value k' id' x + | k' == key = value id' x + | otherwise = empty -------------------------------------------------------------------------------- @@ -51,7 +49,7 @@ defaultContext = -------------------------------------------------------------------------------- bodyField :: String -> Context Page -bodyField key = field key $ arr snd +bodyField key = field key $ \_ x -> return x -------------------------------------------------------------------------------- |
