Compare commits

..

No commits in common. "e37a222c9552e7f54fb7299cd096cb29b2128680" and "7745722009e371a71f5fd6f8048234b8f7303a10" have entirely different histories.

3 changed files with 14 additions and 15 deletions

View file

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

View file

@ -26,7 +26,7 @@ make' :: Strict.Text -> Strict.Text -> GalleryInfo
-> Maybe FilePath -> [(FilePath, Info)] -> Builder -> Maybe FilePath -> [(FilePath, Info)] -> Builder
make' root name ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b| make' root name ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b|
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0">
<channel> <channel>
<title>$name$title</title> <title>$name$title</title>
<link>$link</link> <link>$link</link>
@ -45,7 +45,7 @@ make' root name ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b|
filter (not . (.unlisted) . snd) infos filter (not . (.unlisted) . snd) infos
selflink = case output of selflink = case output of
Nothing -> "" Nothing -> ""
Just o -> [b|<atom:link href="$link/$o" rel="self" />|] Just o -> [b|<link href="$link/$o" rel="self" />|]
makeItem :: Strict.Text -> FilePath -> Bool -> FilePath -> Info -> Builder makeItem :: Strict.Text -> FilePath -> Bool -> FilePath -> Info -> Builder
makeItem root prefix nsfw path info@(Info {title}) = [b| 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 updates = sort $ updatesFor nsfw info
let updatesList = makeUpdates updates let updatesList = makeUpdates updates
let makePrefetch img = [b|<link rel=prefetch href=$path'>|] let makePrefetch img = [b|<link rel=prefetch as=image href=$path'>|]
where path' = bigFile img where path' = bigFile img
let prefetches = map makePrefetch otherImages let prefetches = map makePrefetch otherImages