diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-25 23:26:16 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-25 23:26:16 +0100 |
commit | f61c5a7278613486c214c65080c003682f033c85 (patch) | |
tree | 1cf674fc96aac272c46f1058980611839837c927 /src/Hakyll | |
parent | 6a797b33efd846245d5ba6baebba5732223ae49e (diff) | |
download | hakyll-f61c5a7278613486c214c65080c003682f033c85.tar.gz |
Fix match/version thingy
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Core/Rules.hs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Hakyll/Core/Rules.hs b/src/Hakyll/Core/Rules.hs index ace9cce..2782c88 100644 --- a/src/Hakyll/Core/Rules.hs +++ b/src/Hakyll/Core/Rules.hs @@ -81,13 +81,10 @@ tellResources resources' = Rules $ tell $ -------------------------------------------------------------------------------- -match :: Pattern -> Rules b -> Rules b -match pattern = Rules . censor matchRoutes . local addPattern . unRules +-- | Make sure routes are consistent with the compilers in this section +fixRoutes :: Rules b -> Rules b +fixRoutes = Rules . censor matchRoutes . unRules where - addPattern env = env - { rulesPattern = rulesPattern env `mappend` pattern - } - -- Create a fast pattern for routing that matches exactly the compilers -- created in the block given to match matchRoutes ruleSet = ruleSet @@ -97,10 +94,18 @@ match pattern = Rules . censor matchRoutes . local addPattern . unRules fastPattern = fromList [id' | (id', _) <- rulesCompilers ruleSet] +-------------------------------------------------------------------------------- +match :: Pattern -> Rules b -> Rules b +match pattern = fixRoutes . Rules . local addPattern . unRules + where + addPattern env = env + { rulesPattern = rulesPattern env `mappend` pattern + } + -------------------------------------------------------------------------------- version :: String -> Rules a -> Rules a -version v = Rules . local setVersion' . unRules +version v = fixRoutes . Rules . local setVersion' . unRules where setVersion' env = env {rulesVersion = Just v} |