aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Input.hs
diff options
context:
space:
mode:
authorpacien2020-02-26 22:13:00 +0100
committerNotkea2020-02-27 21:54:32 +0100
commitf09e9d9fa29284bd9ae872efe5ba1d526e349011 (patch)
tree50d523ffb4f2d6e4b1d09eb2edd9f099c9b20048 /compiler/src/Input.hs
parentc7fa5bd40d0e5c9ea50190a90a0ccfee8ad96c25 (diff)
downloadldgallery-f09e9d9fa29284bd9ae872efe5ba1d526e349011.tar.gz
compiler: add tag inclusion and exclusion globs
GitHub: closes #30
Diffstat (limited to 'compiler/src/Input.hs')
-rw-r--r--compiler/src/Input.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/src/Input.hs b/compiler/src/Input.hs
index 75d1ed3..6ed7471 100644
--- a/compiler/src/Input.hs
+++ b/compiler/src/Input.hs
@@ -19,7 +19,7 @@
19module Input 19module Input
20 ( decodeYamlFile 20 ( decodeYamlFile
21 , Sidecar(..) 21 , Sidecar(..)
22 , InputTree(..), readInputTree 22 , InputTree(..), readInputTree, filterInputTree
23 ) where 23 ) where
24 24
25 25
@@ -132,3 +132,14 @@ readInputTree (AnchoredFSNode anchor root@Dir{}) = mkDirNode root
132 132
133 findThumbnail :: [FSNode] -> Maybe Path 133 findThumbnail :: [FSNode] -> Maybe Path
134 findThumbnail = (fmap Files.path) . (find isThumbnail) 134 findThumbnail = (fmap Files.path) . (find isThumbnail)
135
136-- | Filters an InputTree. The root is always returned.
137filterInputTree :: (InputTree -> Bool) -> InputTree -> InputTree
138filterInputTree cond = filterNode
139 where
140 filterNode :: InputTree -> InputTree
141 filterNode inputFile@InputFile{} = inputFile
142 filterNode inputDir@InputDir{items} =
143 filter cond items
144 & map filterNode
145 & \curatedItems -> inputDir { items = curatedItems } :: InputTree