From 645424a7d8fa9210b3d24b2072564552ce6fc59f Mon Sep 17 00:00:00 2001 From: rhiannon morris Date: Mon, 21 Oct 2024 14:36:11 +0200 Subject: [PATCH] consistency with entity escaping --- make-pages/BuilderQQ.hs | 3 ++- make-pages/GalleryPage.hs | 2 +- make-pages/SinglePage.hs | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/make-pages/BuilderQQ.hs b/make-pages/BuilderQQ.hs index 95bba6b..de08612 100644 --- a/make-pages/BuilderQQ.hs +++ b/make-pages/BuilderQQ.hs @@ -64,7 +64,8 @@ escId = foldMap esc1 . Strict.unpack where escAttr :: Strict.Text -> Builder escAttr = foldMap esc1 . Strict.unpack where esc1 c = fromMaybe (singleton c) $ lookup c - [('<', "<"), ('>', ">"), ('"', """), ('\'', "'")] + [('<', "<"), ('>', ">"), ('"', """), ('\'', "'"), + ('&', "&")] class CanBuild a where build :: a -> Builder diff --git a/make-pages/GalleryPage.hs b/make-pages/GalleryPage.hs index 7870691..99c69ca 100644 --- a/make-pages/GalleryPage.hs +++ b/make-pages/GalleryPage.hs @@ -156,7 +156,7 @@ makeItem nsfw file info@(Info {bg}) = [b| |] where - title = fromMaybe info.title info.galleryTitle + title = escAttr $ fromMaybe info.title info.galleryTitle dir = takeDirectory file thumbnail = getThumb dir info nsfw' = if nsfw && anyNsfw info then [b|$& nsfw|] else "" diff --git a/make-pages/SinglePage.hs b/make-pages/SinglePage.hs index d37d3d1..68e85c6 100644 --- a/make-pages/SinglePage.hs +++ b/make-pages/SinglePage.hs @@ -95,7 +95,7 @@ make' root siteName prefix nsfw _dataDir dir Just (Artist {name}) -> [b|by $name|] Nothing -> "by niss" - let alt = image0.desc + let alt = escAttr image0.desc let updateDate = ifJust (last' updates) \(d, _) -> let updated = formatLong d in @@ -117,6 +117,8 @@ make' root siteName prefix nsfw _dataDir dir |] Nothing -> throw $ NoThumb dir + let escTitle = escAttr title + pure [b| @@ -140,13 +142,13 @@ make' root siteName prefix nsfw _dataDir dir $prefetches - $title + $escTitle $nsfwDialog
-

$title

+

$escTitle

$formattedDate $updateDate