on master help sign in
Add getIdentifiers
041ec5cJasper Van der Jeugt
src/Hakyll/Core/Compiler.hs+8
@@ -89,6 +89,7 @@ module Hakyll.Core.Compiler
89 ( Compiler
89 ( Compiler
90 , runCompiler
90 , runCompiler
91 , getIdentifier
91 , getIdentifier
92+ , getIdentifiers
92 , getRoute
93 , getRoute
93 , getRouteFor
94 , getRouteFor
94 , getResourceString
95 , getResourceString
@@ -165,6 +166,13 @@ runCompiler compiler identifier provider routes store modified logger = do
165getIdentifier :: Compiler a Identifier
166getIdentifier :: Compiler a Identifier
166getIdentifier = fromJob $ const $ CompilerM $ compilerIdentifier <$> ask
167getIdentifier = fromJob $ const $ CompilerM $ compilerIdentifier <$> ask
167
168
169+-- | Get all identifiers matching the given pattern
170+--
171+getIdentifiers :: Pattern -> Compiler a [Identifier]
172+getIdentifiers pattern = fromJob $ const $ CompilerM $
173+ matches pattern . map unResource . resourceList
174+ . compilerResourceProvider <$> ask
175+
168-- | Get the route we are using for this item
176-- | Get the route we are using for this item
169--
177--
170getRoute :: Compiler a (Maybe FilePath)
178getRoute :: Compiler a (Maybe FilePath)