diff options
Diffstat (limited to 'lib/Hakyll/Core/Identifier/Pattern.hs')
-rw-r--r-- | lib/Hakyll/Core/Identifier/Pattern.hs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/Hakyll/Core/Identifier/Pattern.hs b/lib/Hakyll/Core/Identifier/Pattern.hs index 5e2597b..d07402d 100644 --- a/lib/Hakyll/Core/Identifier/Pattern.hs +++ b/lib/Hakyll/Core/Identifier/Pattern.hs @@ -75,6 +75,7 @@ import Text.Regex.TDFA ((=~)) -------------------------------------------------------------------------------- import Hakyll.Core.Identifier import Hakyll.Core.Identifier.Pattern.Internal +import Hakyll.Core.Util.String (removeWinPathSeparator) -------------------------------------------------------------------------------- @@ -183,7 +184,7 @@ matches (Complement p) i = not $ matches p i matches (And x y) i = matches x i && matches y i matches (Glob p) i = isJust $ capture (Glob p) i matches (List l) i = i `S.member` l -matches (Regex r) i = (normaliseRegex $ toFilePath i) =~ r +matches (Regex r) i = (removeWinPathSeparator $ toFilePath i) =~ r matches (Version v) i = identifierVersion i == v @@ -205,7 +206,7 @@ splits = inits &&& tails >>> uncurry zip >>> reverse capture :: Pattern -> Identifier -> Maybe [String] capture (Glob p) i = capture' p (toFilePath i) capture (Regex pat) i = Just groups - where (_, _, _, groups) = ((normaliseRegex $ toFilePath i) =~ pat) :: (String, String, String, [String]) + where (_, _, _, groups) = ((removeWinPathSeparator $ toFilePath i) =~ pat) :: (String, String, String, [String]) capture _ _ = Nothing @@ -263,9 +264,3 @@ fromCaptures' (m : ms) [] = case m of fromCaptures' (m : ms) ids@(i : is) = case m of Literal l -> l `mappend` fromCaptures' ms ids _ -> i `mappend` fromCaptures' ms is - - --------------------------------------------------------------------------------- --- | Normalise filepaths to have '/' as a path separator for Regex matching -normaliseRegex :: FilePath -> FilePath -normaliseRegex = concatMap (\c -> if c == '\\' then ['/'] else [c])
\ No newline at end of file |