diff --git a/make-pages/GalleryPage.hs b/make-pages/GalleryPage.hs index 2e9b2aa..7da703c 100644 --- a/make-pages/GalleryPage.hs +++ b/make-pages/GalleryPage.hs @@ -122,11 +122,11 @@ makeYearItems nsfw year infos = [b|@4 year' = show year & foldMap \c -> [b|$'c|] makeItem :: Bool -> FilePath -> Info -> Builder -makeItem nsfw file info@(Info {title}) = [b|@4 +makeItem nsfw file info@(Info {title, bg}) = [b|@4
  • - +
    $*title
    @@ -136,3 +136,4 @@ makeItem nsfw file info@(Info {title}) = [b|@4 thumb = maybe (throw $ NoThumb dir) (\t -> dir thumbFile t) $ #thumb info nsfw' = if nsfw && #anyNsfw info then " nsfw" else "" tags' = fold $ intersperse ";" $ map fromText $ tagsFor nsfw info + bgStyle = ifJust bg \col -> [b| style="background: $*col"|] diff --git a/make-pages/Info.hs b/make-pages/Info.hs index b3ad587..52a9098 100644 --- a/make-pages/Info.hs +++ b/make-pages/Info.hs @@ -39,6 +39,7 @@ data Info = nsfwTags :: ![Text], desc :: !(Maybe Text), nsfwDesc :: !(Maybe Text), + bg :: !(Maybe Text), images :: ![Image], thumb' :: !(Maybe FilePath), links :: ![Link], @@ -125,6 +126,7 @@ instance FromYAML Info where <*> m .:? "nsfw-tags" .!= [] <*> m .:? "desc" <*> m .:? "nsfw-desc" + <*> m .:? "bg" <*> (m .: "images" >>= imageList) <*> m .:? "thumb" <*> m .:? "links" .!= [] diff --git a/make-pages/SinglePage.hs b/make-pages/SinglePage.hs index 9b52772..27aff57 100644 --- a/make-pages/SinglePage.hs +++ b/make-pages/SinglePage.hs @@ -32,7 +32,7 @@ make :: Bool -- ^ nsfw? make nsfw dataDir dir info = toLazyText <$> make' nsfw dataDir dir info make' :: Bool -> FilePath -> FilePath -> Info -> IO Builder -make' nsfw dataDir dir info@(Info {date, title, artist}) = do +make' nsfw dataDir dir info@(Info {date, title, artist, bg}) = do images <- withSizes (dataDir dir) $ imagesFor nsfw info let undir = joinPath (replicate (length (splitPath dir)) "..") @@ -59,7 +59,11 @@ make' nsfw dataDir dir info@(Info {date, title, artist}) = do
    cw: $*w
    - |] + |] + + let bgStyle = ifJust bg \col -> [b|@0 + + |] pure [b|@0 @@ -70,6 +74,7 @@ make' nsfw dataDir dir info@(Info {date, title, artist}) = do + $bgStyle $0.prefetches