diff --git a/make-pages/GalleryPage.hs b/make-pages/GalleryPage.hs index 8edfba1..c440d3f 100644 --- a/make-pages/GalleryPage.hs +++ b/make-pages/GalleryPage.hs @@ -13,6 +13,7 @@ import qualified Data.HashMap.Strict as HashMap import Data.HashSet (HashSet) import qualified Data.HashSet as HashSet import Data.List (intersperse, groupBy, sortBy, sortOn) +import Data.Maybe import qualified Data.Text.Lazy as Lazy import System.FilePath (takeDirectory, joinPath, splitPath) import GHC.Exts (Down (..), the) @@ -145,7 +146,7 @@ makeYearItems nsfw year infos = [b|@0 year' = show year & foldMap \c -> [b|$c|] makeItem :: Bool -> FilePath -> Info -> Builder -makeItem nsfw file info@(Info {title, bg}) = [b|@0 +makeItem nsfw file info@(Info {bg}) = [b|@0
  • @@ -160,6 +161,7 @@ makeItem nsfw file info@(Info {title, bg}) = [b|@0 |] where + title = fromMaybe (#title info) $ #galleryTitle info dir = takeDirectory file thumb = getThumb dir info nsfw' = if nsfw && #anyNsfw info then [b| nsfw|] else "" diff --git a/make-pages/Info.hs b/make-pages/Info.hs index 8f8a018..ca33537 100644 --- a/make-pages/Info.hs +++ b/make-pages/Info.hs @@ -39,28 +39,29 @@ import Data.Bifunctor (second) data Info = Info { - date :: !Date, + date :: !Date, -- | extra sort key after date -- e.g. multiple things on the same day might have a,b,c in @sortEx@ to -- put them in the right order in the gallery - sortEx :: !Text, - updates :: ![Update], + sortEx :: !Text, + updates :: ![Update], -- | if false, don't show updated emblem even if @updates@ is non-empty - showUpdated :: !Bool, + showUpdated :: !Bool, -- | hide from gallery view - unlisted :: !Bool, - title :: !Text, - artist :: !(Maybe Artist), -- nothing = me, obv - nsfwOnly :: !Bool, - tags :: ![Text], - nsfwTags :: ![Text], - desc :: !Desc, - nsfwDesc :: !Desc, - bg :: !(Maybe Text), - images :: !Images, - thumb' :: !(Maybe FilePath), - links :: ![Link], - extras :: ![FilePath] + unlisted :: !Bool, + title :: !Text, + galleryTitle :: !(Maybe Text), + artist :: !(Maybe Artist), -- nothing = me, obv + nsfwOnly :: !Bool, + tags :: ![Text], + nsfwTags :: ![Text], + desc :: !Desc, + nsfwDesc :: !Desc, + bg :: !(Maybe Text), + images :: !Images, + thumb' :: !(Maybe FilePath), + links :: ![Link], + extras :: ![FilePath] } deriving (Eq, Show) @@ -257,15 +258,17 @@ checkKeys mapping wanted = do instance FromYAML Info where parseYAML = YAML.withMap "info" \m -> do - checkKeys m ["date", "sort", "updates", "show-updated", "unlisted", "title", - "artist", "nsfw-only", "tags", "nsfw-tags", "desc", - "nsfw-desc", "bg", "images", "thumb", "links", "extras"] + checkKeys m ["date", "sort", "updates", "show-updated", "unlisted", + "gallery-title", "title", "artist", "nsfw-only", "tags", + "nsfw-tags", "desc", "nsfw-desc", "bg", "images", "thumb", + "links", "extras"] Info <$> m .: "date" <*> m .:? "sort" .!= "" <*> (m .:? "updates" >>= updateList) <*> m .:? "show-updated" .!= True <*> m .:? "unlisted" .!= False <*> m .: "title" + <*> m .:? "gallery-title" <*> m .:? "artist" <*> m .:? "nsfw-only" .!= False <*> m .:? "tags" .!= []