fix images in rss feed

- escape alt text
- add "full image hidden" message if it is
This commit is contained in:
rhiannon morris 2024-10-21 14:38:35 +02:00
parent 5944a55020
commit c088389889

View file

@ -87,16 +87,21 @@ makeItem root prefix nsfw path info@(Info {title}) = [b|
Artist name (Just url) -> [b|<p>by <a href="$url">$name</a>|] Artist name (Just url) -> [b|<p>by <a href="$url">$name</a>|]
desc = makeDesc $ descFor nsfw info desc = makeDesc $ descFor nsfw info
image = case previewImage info of preview = previewImage info
Just (PFull img) -> figure img.desc $ pageFile img image = case preview of
Just (PFull img) -> figure (escAttr img.desc) $ pageFile img
Just (PThumb th) -> figure "full image hidden" $ thumbFile th Just (PThumb th) -> figure "full image hidden" $ thumbFile th
Nothing -> "" Nothing -> ""
msg = case preview of
Just (PThumb _) -> "<p>(full image hidden; open to see)</p>"
_ -> "" :: Text
figure alt p = [b| figure alt p = [b|
<figure aria-describedby=mainimg> <figure aria-describedby=mainimg>
<a href="$link"> <a href="$link">
<img id=mainimg src="$link/$p" alt="$alt" title="$alt"> <img id=mainimg src="$link/$p" alt="$alt" title="$alt">
</a> </a>
</figure> </figure>
$msg
|] |]
makeDesc :: Desc -> Builder makeDesc :: Desc -> Builder