diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-01 18:56:16 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-01 18:56:16 +0100 |
commit | 52170d86edc63ec7867220fc208733656d3e42cf (patch) | |
tree | 3f89b1f5dd607b8ebec4f323a090ef0379584fbd /src | |
parent | 93db3d652f37004075401f278433d7090beaf221 (diff) | |
download | hakyll-52170d86edc63ec7867220fc208733656d3e42cf.tar.gz |
Fix routes for specific list/group combo
Diffstat (limited to 'src')
-rw-r--r-- | src/Hakyll/Core/Rules.hs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/Hakyll/Core/Rules.hs b/src/Hakyll/Core/Rules.hs index a234306..ace9cce 100644 --- a/src/Hakyll/Core/Rules.hs +++ b/src/Hakyll/Core/Rules.hs @@ -82,12 +82,21 @@ tellResources resources' = Rules $ tell $ -------------------------------------------------------------------------------- match :: Pattern -> Rules b -> Rules b -match pattern = Rules . local addPattern . unRules +match pattern = Rules . censor matchRoutes . local addPattern . 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 + { rulesRoutes = matchRoute fastPattern (rulesRoutes ruleSet) + } + where + fastPattern = fromList [id' | (id', _) <- rulesCompilers ruleSet] + + -------------------------------------------------------------------------------- version :: String -> Rules a -> Rules a @@ -122,13 +131,7 @@ compile compiler = do -- -- This adds a route for all items matching the current pattern. route :: Routes -> Rules () -route route' = Rules $ do - -- We want the route only to be applied if we match the current pattern and - -- version - pattern <- rulesPattern <$> ask - version' <- rulesVersion <$> ask - unRules $ tellRoute $ matchRoute - (pattern `mappend` fromVersion version') route' +route = tellRoute -------------------------------------------------------------------------------- |