Compare commits

..

2 commits

Author SHA1 Message Date
e37a222c95 <link rel=prefetch> doesn't have an as attr 2024-08-18 08:59:59 +02:00
177bdba331 i broke rss :o 2024-08-18 08:59:29 +02:00
3 changed files with 15 additions and 14 deletions

View file

@ -19,7 +19,8 @@ import Data.List.NonEmpty (NonEmpty, toList)
data Chunk = Lit String | Var String
parseB :: String -> ExpQ
parseB = toExpQ . reverse . go "" [] . dropWhileEnd isSpace where
parseB = toExpQ . reverse . go "" [] . trim where
trim = dropWhileEnd isSpace . dropWhile (== '\n')
go acc cs [] = addLit acc cs
go acc cs ('$':'&':rest) = go acc cs rest -- $&: expands to nothing
go acc cs ('$':'$':rest) = go ('$' : acc) cs rest -- $$: expands to one $

View file

@ -25,18 +25,18 @@ make root name ginfo output infos =
make' :: Strict.Text -> Strict.Text -> GalleryInfo
-> Maybe FilePath -> [(FilePath, Info)] -> Builder
make' root name ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b|
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>$name$title</title>
<link>$link</link>
<description>$desc</description>
$selflink
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>$name$title</title>
<link>$link</link>
<description>$desc</description>
$selflink
$items
</channel>
</rss>
|]
$items
</channel>
</rss>
|]
where
link = [b|$root/$prefix|]
nsfw = ginfo.nsfw
@ -45,7 +45,7 @@ make' root name ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b|
filter (not . (.unlisted) . snd) infos
selflink = case output of
Nothing -> ""
Just o -> [b|<link href="$link/$o" rel="self" />|]
Just o -> [b|<atom:link href="$link/$o" rel="self" />|]
makeItem :: Strict.Text -> FilePath -> Bool -> FilePath -> Info -> Builder
makeItem root prefix nsfw path info@(Info {title}) = [b|

View file

@ -62,7 +62,7 @@ make' root siteName prefix nsfw _dataDir dir
let updates = sort $ updatesFor nsfw info
let updatesList = makeUpdates updates
let makePrefetch img = [b|<link rel=prefetch as=image href=$path'>|]
let makePrefetch img = [b|<link rel=prefetch href=$path'>|]
where path' = bigFile img
let prefetches = map makePrefetch otherImages