@@ -19,6 +19,7 @@
19module Hakyll.Core.Rules
19module Hakyll.Core.Rules
@@ -120,16 +121,26 @@ flush = Rules $ do
122--------------------------------------------------------------------------------
123--------------------------------------------------------------------------------
123−match :: Pattern -> Rules () -> Rules ()
124+matchInternal :: Pattern -> Rules [Identifier] -> Rules () -> Rules ()
124−match pattern rules = do
125+matchInternal pattern getIDs rules = do
125 tellPattern pattern
126 tellPattern pattern
127− ids <- getMatches pattern
128+ ids <- getIDs
128 tellResources ids
129 tellResources ids
129 Rules $ local (setMatches ids) $ unRules $ rules >> flush
130 Rules $ local (setMatches ids) $ unRules $ rules >> flush
131 setMatches ids env = env {rulesMatches = ids}
132 setMatches ids env = env {rulesMatches = ids}
134+--------------------------------------------------------------------------------
135+match :: Pattern -> Rules () -> Rules ()
136+match pattern = matchInternal pattern $ getMatches pattern
139+--------------------------------------------------------------------------------
140+matchMetadata :: Pattern -> (Metadata -> Bool) -> Rules () -> Rules ()
141+matchMetadata pattern metadataPred = matchInternal pattern $
142+ map fst . filter (metadataPred . snd) <$> getAllMetadata pattern
134--------------------------------------------------------------------------------
145--------------------------------------------------------------------------------
135create :: [Identifier] -> Rules () -> Rules ()
146create :: [Identifier] -> Rules () -> Rules ()