From 6c84d4eb1cd689d6a921e27be3bbc6b0feeb7aea Mon Sep 17 00:00:00 2001 From: Rhiannon Morris Date: Wed, 5 Aug 2020 00:52:39 +0200 Subject: [PATCH] allow extra images etc --- make-pages/Depend.hs | 7 ++++--- make-pages/Info.hs | 22 ++++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/make-pages/Depend.hs b/make-pages/Depend.hs index f85edb6..0d8c9a2 100644 --- a/make-pages/Depend.hs +++ b/make-pages/Depend.hs @@ -27,13 +27,14 @@ dependSingle' yamlDir info prefix build nsfw = where images = if nsfw then #images info else #sfwImages info - paths = map #path images - dls = mapMaybe #download images + paths = map #path images + dls = mapMaybe #download images + extras = #extras info dir = build prefix yamlDir page = dir "index.html" deps = unwords $ map (dir ) $ - thumbFile (thumbnail info) : map pageFile paths ++ paths ++ dls + thumbFile (thumbnail info) : map pageFile paths ++ paths ++ dls ++ extras dependGallery :: GalleryInfo -> FilePath -- ^ index file diff --git a/make-pages/Info.hs b/make-pages/Info.hs index 73bfd47..42ff82c 100644 --- a/make-pages/Info.hs +++ b/make-pages/Info.hs @@ -40,7 +40,8 @@ data Info = nsfwDesc :: !(Maybe Text), images :: ![Image], thumb' :: !(Maybe FilePath), - links :: ![Link] + links :: ![Link], + extras :: ![FilePath] } deriving (Eq, Show) @@ -117,16 +118,17 @@ instance Ord Info where instance FromYAML Info where parseYAML = YAML.withMap "info" \m -> - Info <$> m .: "date" - <*> m .: "title" - <*> m .:? "artist" - <*> m .:? "tags" .!= [] - <*> m .:? "nsfw-tags" .!= [] - <*> m .:? "desc" - <*> m .:? "nsfw-desc" + Info <$> m .: "date" + <*> m .: "title" + <*> m .:? "artist" + <*> m .:? "tags" .!= [] + <*> m .:? "nsfw-tags" .!= [] + <*> m .:? "desc" + <*> m .:? "nsfw-desc" <*> (m .: "images" >>= imageList) - <*> m .:? "thumb" - <*> m .:? "links" .!= [] + <*> m .:? "thumb" + <*> m .:? "links" .!= [] + <*> m .:? "extras" .!= [] instance FromYAML Artist where parseYAML y = justName y <|> withUrl y where