- $title
+ $name—$title
$link
$desc
$selflink
@@ -43,37 +44,54 @@ make' root ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b|@0
filter (not . (.unlisted) . snd) infos
selflink = case output of
Nothing -> ""
- Just o -> [b||]
+ Just o -> [b||]
makeItem :: Strict.Text -> FilePath -> Bool -> FilePath -> Info -> Builder
makeItem root prefix nsfw path i@(Info {title, artist}) = [b|@4
-
- $title$up
+ $title$suf
$link
$link
- $descArtist'
+ $body
$date
|]
where
- up = if hasUpdatesFor nsfw i then [b| (updated)|] else ""
+ suf = let parts = catMaybes [o18, cnt, up] in
+ if null parts then ""
+ else " (" <> mconcat (intersperse ", " parts) <> ")"
+ up = if hasUpdatesFor nsfw i then Just "updated" else Nothing
+ o18 = if nsfw && anyNsfw i then Just "🔞" else Nothing
+ cnt = let len = maybe 0 length $ allImages <$> imagesFor nsfw i in
+ if len == 1 then Nothing else Just [b|$len images|]
+
dir = takeDirectory path
link = [b|$root/$prefix/$dir|]
+
+ date = formatRSS $ latestDateFor nsfw i
artist' = ifJust artist \case
Artist {name, url = Nothing} -> [b|by $name|]
- Artist {name, url = Just url} -> [b|
by $name|]
+ Artist {name, url = Just url} -> [b|
by $name|]
desc = descFor nsfw i
desc' = makeDesc desc
- descArtist' = if desc.exists || isJust artist then [b|@6
-
-
-
+
+ body = [b|@6
+
|]
- else ""
- date = formatRSS $ latestDateFor nsfw i
+
+ image = case previewImage i of
+ Just (PFull img) -> go $ pageFile img
+ Just (PThumb th) -> go $ thumbFile th
+ Nothing -> ""
+ where go p = [b|@0
+
+ |]
makeDesc :: Desc -> Builder
makeDesc NoDesc = ""
diff --git a/make-pages/SinglePage.hs b/make-pages/SinglePage.hs
index b2644a3..2852716 100644
--- a/make-pages/SinglePage.hs
+++ b/make-pages/SinglePage.hs
@@ -9,7 +9,7 @@ import qualified NsfwWarning
import Control.Exception
import Control.Monad
import Data.List (sort, intersperse)
-import Data.Maybe (fromMaybe, isNothing, isJust)
+import Data.Maybe (fromMaybe, isJust)
import qualified Data.Text as Strict
import qualified Data.Text.Lazy as Lazy
import System.FilePath (joinPath, splitPath)
@@ -94,7 +94,6 @@ make' root siteName prefix nsfw _dataDir dir
let desc = case artist of
Just (Artist {name}) -> [b|by $name|]
Nothing -> "by niss"
- let thumbnail = getThumb "" info
let updateDate = ifJust (last' updates) \(d, _) ->
let updated = formatLong d in
@@ -104,15 +103,17 @@ make' root siteName prefix nsfw _dataDir dir
let nsfwScript = NsfwWarning.script nsfw'
let nsfwDialog = NsfwWarning.dialog nsfw'
- let imageMeta =
- if image0.sfw && isNothing image0.warning then [b|@0
-
-
-
- |] else [b|@0
-
-
- |]
+ let imageMeta = case previewImage info of
+ Just (PFull (Image {path})) -> [b|@0
+
+
+
+ |]
+ Just (PThumb path) -> [b|@0
+
+
+ |]
+ Nothing -> throw $ NoThumb dir
pure [b|@0