use nsfw-desc in rss where appropriate

This commit is contained in:
Rhiannon Morris 2021-03-07 22:07:02 +01:00
parent c1d588f702
commit 519a50489f

View file

@ -39,14 +39,14 @@ make' root ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b|@0
where
link = [b|$root/$prefix|]
nsfw = #nsfw ginfo
items = map (uncurry $ makeItem root prefix) $
items = map (uncurry $ makeItem root prefix nsfw) $
sortBy (flip (compareFor nsfw `on` #second)) infos
selflink = case output of
Nothing -> ""
Just o -> [b|<atom:link href="$link/$o" rel="self" />|]
makeItem :: Strict.Text -> FilePath -> FilePath -> Info -> Builder
makeItem root prefix path (Info {title, desc, date, artist}) = [b|@4
makeItem :: Strict.Text -> FilePath -> Bool -> FilePath -> Info -> Builder
makeItem root prefix nsfw path i@(Info {title, date, artist}) = [b|@4
<item>
<title>$title</title>
<link>$link</link>
@ -61,12 +61,13 @@ makeItem root prefix path (Info {title, desc, date, artist}) = [b|@4
artist' = ifJust artist \case
Artist {name, url = Nothing} -> [b|<p>by $name|]
Artist {name, url = Just url} -> [b|<p>by <a href=$url>$name</a>|]
desc = descFor nsfw i
desc' = ifJust desc \d -> [b|$10.d|]
descArtist' = if isJust desc || isJust artist then [b|@6
<description>
<![CDATA[
$desc'
$artist'
$10.desc'
$10.artist'
]]>
</description>
|]