summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Identifier/Pattern.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Core/Identifier/Pattern.hs')
-rw-r--r--src/Hakyll/Core/Identifier/Pattern.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Identifier/Pattern.hs b/src/Hakyll/Core/Identifier/Pattern.hs
index 348ef46..cee4bbc 100644
--- a/src/Hakyll/Core/Identifier/Pattern.hs
+++ b/src/Hakyll/Core/Identifier/Pattern.hs
@@ -36,6 +36,7 @@ module Hakyll.Core.Identifier.Pattern
, parseGlob
, predicate
, regex
+ , inGroup
, matches
, filterMatches
, capture
@@ -106,6 +107,12 @@ predicate = Predicate
regex :: String -> Pattern
regex str = predicate $ fromMaybe False . (=~~ str) . toFilePath
+-- | Create a 'Pattern' which matches if the identifier is in a certain group
+-- (or in no group)
+--
+inGroup :: Maybe String -> Pattern
+inGroup group = predicate $ (== group) . identifierGroup
+
-- | Check if an identifier matches a pattern
--
matches :: Pattern -> Identifier -> Bool