diff options
Diffstat (limited to 'compiler/src/Compiler.hs')
-rw-r--r-- | compiler/src/Compiler.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs index 749872d..2bb27f9 100644 --- a/compiler/src/Compiler.hs +++ b/compiler/src/Compiler.hs | |||
@@ -81,16 +81,16 @@ writeJSON outputPath object = | |||
81 | (|||) = liftM2 (||) | 81 | (|||) = liftM2 (||) |
82 | 82 | ||
83 | anyPattern :: [String] -> String -> Bool | 83 | anyPattern :: [String] -> String -> Bool |
84 | anyPattern patterns string = any (flip Glob.match string) (map Glob.compile patterns) | 84 | anyPattern patterns string = any (flip Glob.match string . Glob.compile) patterns |
85 | 85 | ||
86 | galleryDirFilter :: GalleryConfig -> [FilePath] -> FSNode -> Bool | 86 | galleryDirFilter :: GalleryConfig -> [FilePath] -> FSNode -> Bool |
87 | galleryDirFilter config excludedCanonicalDirs = | 87 | galleryDirFilter config excludedCanonicalDirs = |
88 | (not . isHidden) | 88 | (not . isHidden) |
89 | &&& (not . isExcludedDir) | 89 | &&& (not . isExcludedDir) |
90 | &&& ((matchesDir $ anyPattern $ includedDirectories config) ||| | 90 | &&& (matchesDir (anyPattern $ includedDirectories config) ||| |
91 | (matchesFile $ anyPattern $ includedFiles config)) | 91 | matchesFile (anyPattern $ includedFiles config)) |
92 | &&& (not . ((matchesDir $ anyPattern $ excludedDirectories config) ||| | 92 | &&& (not . (matchesDir (anyPattern $ excludedDirectories config) ||| |
93 | (matchesFile $ anyPattern $ excludedFiles config))) | 93 | matchesFile (anyPattern $ excludedFiles config))) |
94 | 94 | ||
95 | where | 95 | where |
96 | matchesDir :: (FileName -> Bool) -> FSNode -> Bool | 96 | matchesDir :: (FileName -> Bool) -> FSNode -> Bool |
@@ -102,17 +102,17 @@ galleryDirFilter config excludedCanonicalDirs = | |||
102 | matchesFile _ Dir{} = False | 102 | matchesFile _ Dir{} = False |
103 | 103 | ||
104 | isExcludedDir :: FSNode -> Bool | 104 | isExcludedDir :: FSNode -> Bool |
105 | isExcludedDir Dir{canonicalPath} = any (canonicalPath ==) excludedCanonicalDirs | 105 | isExcludedDir Dir{canonicalPath} = canonicalPath `elem` excludedCanonicalDirs |
106 | isExcludedDir File{} = False | 106 | isExcludedDir File{} = False |
107 | 107 | ||
108 | inputTreeFilter :: GalleryConfig -> InputTree -> Bool | 108 | inputTreeFilter :: GalleryConfig -> InputTree -> Bool |
109 | inputTreeFilter GalleryConfig{includedTags, excludedTags} = | 109 | inputTreeFilter GalleryConfig{includedTags, excludedTags} = |
110 | (hasTagMatching $ anyPattern includedTags) | 110 | hasTagMatching (anyPattern includedTags) |
111 | &&& (not . (hasTagMatching $ anyPattern excludedTags)) | 111 | &&& (not . hasTagMatching (anyPattern excludedTags)) |
112 | 112 | ||
113 | where | 113 | where |
114 | hasTagMatching :: (String -> Bool) -> InputTree -> Bool | 114 | hasTagMatching :: (String -> Bool) -> InputTree -> Bool |
115 | hasTagMatching cond = (any cond) . (fromMaybe [""] . tags) . sidecar | 115 | hasTagMatching cond = any cond . (fromMaybe [""] . tags) . sidecar |
116 | 116 | ||
117 | 117 | ||
118 | compileGallery :: FilePath -> FilePath -> FilePath -> FilePath -> [FilePath] -> Bool -> Bool -> IO () | 118 | compileGallery :: FilePath -> FilePath -> FilePath -> FilePath -> [FilePath] -> Bool -> Bool -> IO () |