make sfw info fields a bit clearer
This commit is contained in:
parent
75b91f43b4
commit
cc65ebb388
2 changed files with 6 additions and 3 deletions
|
@ -17,7 +17,7 @@ dependSingle :: FilePath -- ^ yaml file name (relative to data dir!)
|
||||||
-> Text
|
-> Text
|
||||||
dependSingle yaml info prefix build nsfw =
|
dependSingle yaml info prefix build nsfw =
|
||||||
let dir = build </> prefix </> takeDirectory yaml
|
let dir = build </> prefix </> takeDirectory yaml
|
||||||
images = if nsfw then #images info else filter #sfw $ #images info
|
images = if nsfw then #images info else #sfwImages info
|
||||||
paths = map #path images
|
paths = map #path images
|
||||||
index = dir </> "index.html"
|
index = dir </> "index.html"
|
||||||
deps = thumbFile (thumbnail info) : map pageFile paths ++ paths
|
deps = thumbFile (thumbnail info) : map pageFile paths ++ paths
|
||||||
|
|
|
@ -57,11 +57,14 @@ data Link =
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
instance HasField "nsfw" Info Bool where getField = all #nsfw . #images
|
|
||||||
instance HasField "sfw" Info Bool where getField = not . #nsfw
|
|
||||||
instance HasField "sfw" Image Bool where getField = not . #nsfw
|
instance HasField "sfw" Image Bool where getField = not . #nsfw
|
||||||
instance HasField "sfw" Link Bool where getField = not . #nsfw
|
instance HasField "sfw" Link Bool where getField = not . #nsfw
|
||||||
|
|
||||||
|
instance HasField "sfwImages" Info [Image] where
|
||||||
|
getField = filter #sfw . #images
|
||||||
|
instance HasField "allNsfw" Info Bool where getField = null . #sfwImages
|
||||||
|
instance HasField "anySfw" Info Bool where getField = not . #allNsfw
|
||||||
|
|
||||||
instance HasField "thumb" Info (Maybe FilePath) where
|
instance HasField "thumb" Info (Maybe FilePath) where
|
||||||
getField (Info {thumb', images}) = thumb' <|> #path <$> find #sfw images
|
getField (Info {thumb', images}) = thumb' <|> #path <$> find #sfw images
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue