i broke rss :o
This commit is contained in:
parent
7745722009
commit
177bdba331
2 changed files with 14 additions and 13 deletions
|
@ -19,7 +19,8 @@ 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 "" [] . dropWhileEnd isSpace where
|
parseB = toExpQ . reverse . go "" [] . trim 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 $
|
||||||
|
|
|
@ -25,8 +25,8 @@ make root name ginfo output infos =
|
||||||
make' :: Strict.Text -> Strict.Text -> GalleryInfo
|
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">
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
<title>$name—$title</title>
|
<title>$name—$title</title>
|
||||||
<link>$link</link>
|
<link>$link</link>
|
||||||
|
@ -35,8 +35,8 @@ make' root name ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b|
|
||||||
|
|
||||||
$items
|
$items
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|]
|
|]
|
||||||
where
|
where
|
||||||
link = [b|$root/$prefix|]
|
link = [b|$root/$prefix|]
|
||||||
nsfw = ginfo.nsfw
|
nsfw = ginfo.nsfw
|
||||||
|
@ -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|<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 :: 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|
|
||||||
|
|
Loading…
Reference in a new issue