use class instead of twigils for builder
This commit is contained in:
parent
e810c3eb08
commit
2adee9ee8e
8 changed files with 140 additions and 155 deletions
|
@ -27,9 +27,9 @@ make' root (GalleryInfo {title, desc, prefix}) output infos = [b|@0
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>$*title</title>
|
||||
<title>$title</title>
|
||||
<link>$link</link>
|
||||
<description>$*desc</description>
|
||||
<description>$desc</description>
|
||||
$selflink
|
||||
|
||||
$4.items
|
||||
|
@ -37,16 +37,16 @@ make' root (GalleryInfo {title, desc, prefix}) output infos = [b|@0
|
|||
</rss>
|
||||
|]
|
||||
where
|
||||
link = [b|$*root/$@prefix|]
|
||||
link = [b|$root/$prefix|]
|
||||
items = map (uncurry $ makeItem root prefix) $ sortOn (Down . #second) infos
|
||||
selflink = case output of
|
||||
Nothing -> ""
|
||||
Just o -> [b|<atom:link href="$link/$@o" rel="self" />|]
|
||||
Just o -> [b|<atom:link href="$link/$o" rel="self" />|]
|
||||
|
||||
makeItem :: Strict.Text -> FilePath -> FilePath -> Info -> Builder
|
||||
makeItem root prefix path (Info {title, desc, date, artist}) = [b|@4
|
||||
<item>
|
||||
<title>$*title</title>
|
||||
<title>$title</title>
|
||||
<link>$link</link>
|
||||
<guid>$link</guid>
|
||||
$descArtist'
|
||||
|
@ -55,11 +55,11 @@ makeItem root prefix path (Info {title, desc, date, artist}) = [b|@4
|
|||
|]
|
||||
where
|
||||
dir = takeDirectory path
|
||||
link = [b|$*root/$@prefix/$@dir|]
|
||||
link = [b|$root/$prefix/$dir|]
|
||||
artist' = ifJust artist \case
|
||||
Artist {name, url = Nothing} -> [b|<p>by $*name|]
|
||||
Artist {name, url = Just url} -> [b|<p>by <a href=$*url>$*name</a>|]
|
||||
desc' = ifJust desc \d -> [b|$10*d|]
|
||||
Artist {name, url = Nothing} -> [b|<p>by $name|]
|
||||
Artist {name, url = Just url} -> [b|<p>by <a href=$url>$name</a>|]
|
||||
desc' = ifJust desc \d -> [b|$10.d|]
|
||||
descArtist' = if isJust desc || isJust artist then [b|@6
|
||||
<description>
|
||||
<![CDATA[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue