allow extra images etc

This commit is contained in:
Rhiannon Morris 2020-08-05 00:52:39 +02:00
parent 813d802fce
commit 6c84d4eb1c
2 changed files with 16 additions and 13 deletions

View file

@ -27,13 +27,14 @@ dependSingle' yamlDir info prefix build nsfw =
where where
images = if nsfw then #images info else #sfwImages info images = if nsfw then #images info else #sfwImages info
paths = map #path images paths = map #path images
dls = mapMaybe #download images dls = mapMaybe #download images
extras = #extras info
dir = build </> prefix </> yamlDir dir = build </> prefix </> yamlDir
page = dir </> "index.html" page = dir </> "index.html"
deps = unwords $ map (dir </>) $ deps = unwords $ map (dir </>) $
thumbFile (thumbnail info) : map pageFile paths ++ paths ++ dls thumbFile (thumbnail info) : map pageFile paths ++ paths ++ dls ++ extras
dependGallery :: GalleryInfo dependGallery :: GalleryInfo
-> FilePath -- ^ index file -> FilePath -- ^ index file

View file

@ -40,7 +40,8 @@ data Info =
nsfwDesc :: !(Maybe Text), nsfwDesc :: !(Maybe Text),
images :: ![Image], images :: ![Image],
thumb' :: !(Maybe FilePath), thumb' :: !(Maybe FilePath),
links :: ![Link] links :: ![Link],
extras :: ![FilePath]
} }
deriving (Eq, Show) deriving (Eq, Show)
@ -117,16 +118,17 @@ instance Ord Info where
instance FromYAML Info where instance FromYAML Info where
parseYAML = YAML.withMap "info" \m -> parseYAML = YAML.withMap "info" \m ->
Info <$> m .: "date" Info <$> m .: "date"
<*> m .: "title" <*> m .: "title"
<*> m .:? "artist" <*> m .:? "artist"
<*> m .:? "tags" .!= [] <*> m .:? "tags" .!= []
<*> m .:? "nsfw-tags" .!= [] <*> m .:? "nsfw-tags" .!= []
<*> m .:? "desc" <*> m .:? "desc"
<*> m .:? "nsfw-desc" <*> m .:? "nsfw-desc"
<*> (m .: "images" >>= imageList) <*> (m .: "images" >>= imageList)
<*> m .:? "thumb" <*> m .:? "thumb"
<*> m .:? "links" .!= [] <*> m .:? "links" .!= []
<*> m .:? "extras" .!= []
instance FromYAML Artist where instance FromYAML Artist where
parseYAML y = justName y <|> withUrl y where parseYAML y = justName y <|> withUrl y where