Add list support

This commit is contained in:
Zed
2019-09-21 01:08:30 +02:00
parent d1fbcef64d
commit 9e3138e51b
25 changed files with 224 additions and 39 deletions

View File

@@ -71,3 +71,29 @@
</channel>
</rss>
#end proc
#
#proc renderListRss*(tweets: seq[Tweet]; name, list: string): string =
#let prefs = Prefs(replaceTwitter: hostname)
#result = ""
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<atom:link href="https://${hostname}/${name}/lists/${list}/rss" rel="self" type="application/rss+xml" />
<title>${list} / @${name}</title>
<link>https://${hostname}/${name}/lists/${list}</link>
<description>Twitter feed for: ${list} by @${name}. Generated by ${hostname}</description>
<language>en-us</language>
<ttl>40</ttl>
#for tweet in tweets:
<item>
<title>${getTitle(tweet, prefs)}</title>
<dc:creator>@${tweet.profile.username}</dc:creator>
<description><![CDATA[${renderRssTweet(tweet, prefs).strip(chars={'\n'})}]]></description>
<pubDate>${getRfc822Time(tweet)}</pubDate>
<guid>https://${hostname}${getLink(tweet)}</guid>
<link>https://${hostname}${getLink(tweet)}</link>
</item>
#end for
</channel>
</rss>
#end proc