From 52170d86edc63ec7867220fc208733656d3e42cf Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt <m@jaspervdj.be> Date: Sat, 1 Dec 2012 18:56:16 +0100 Subject: Fix routes for specific list/group combo --- src/Hakyll/Core/Rules.hs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') 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 -------------------------------------------------------------------------------- -- cgit v1.2.3