on master help sign in
Fix routes for specific list/group combo
commit52170d86edc63ec7867220fc208733656d3e42cf authorJasper Van der Jeugt <m@jaspervdj.be> dateSat 1 Dec 2012, 18:56 (14 years ago) parent93db3d6
1 file changed+11−8
src/Hakyll/Core/Rules.hs+11−8
src/Hakyll/Core/Rules.hs+11−8
@@ -82,12 +82,21 @@ tellResources resources' = Rules $ tell $
8282
8383--------------------------------------------------------------------------------
8484match :: Pattern -> Rules b -> Rules b
85−match pattern = Rules . local addPattern . unRules
85+match pattern = Rules . censor matchRoutes . local addPattern . unRules
8686 where
8787 addPattern env = env
8888 { rulesPattern = rulesPattern env `mappend` pattern
8989 }
9090
91+ -- Create a fast pattern for routing that matches exactly the compilers
92+ -- created in the block given to match
93+ matchRoutes ruleSet = ruleSet
94+ { rulesRoutes = matchRoute fastPattern (rulesRoutes ruleSet)
95+ }
96+ where
97+ fastPattern = fromList [id' | (id', _) <- rulesCompilers ruleSet]
98+
99+
91100
92101--------------------------------------------------------------------------------
93102version :: String -> Rules a -> Rules a
@@ -122,13 +131,7 @@ compile compiler = do
122131--
123132-- This adds a route for all items matching the current pattern.
124133route :: Routes -> Rules ()
125−route route' = Rules $ do
126− -- We want the route only to be applied if we match the current pattern and
127− -- version
128− pattern <- rulesPattern <$> ask
129− version' <- rulesVersion <$> ask
130− unRules $ tellRoute $ matchRoute
131− (pattern `mappend` fromVersion version') route'
134+route = tellRoute
132135
133136
134137--------------------------------------------------------------------------------