Merge branch 'nicer-rss'

This commit is contained in:
Zed 2021-12-30 02:22:39 +01:00
commit 173dd8f016

View file

@ -1,6 +1,6 @@
#? stdtmpl(subsChar = '$', metaChar = '#') #? stdtmpl(subsChar = '$', metaChar = '#')
## SPDX-License-Identifier: AGPL-3.0-only ## SPDX-License-Identifier: AGPL-3.0-only
#import strutils, xmltree, strformat, options #import strutils, xmltree, strformat, options, unicode
#import ../types, ../utils, ../formatters, ../prefs #import ../types, ../utils, ../formatters, ../prefs
# #
#proc getTitle(tweet: Tweet; retweet: string): string = #proc getTitle(tweet: Tweet; retweet: string): string =
@ -8,7 +8,11 @@
#elif retweet.len > 0: result = &"RT by @{retweet}: " #elif retweet.len > 0: result = &"RT by @{retweet}: "
#elif tweet.reply.len > 0: result = &"R to @{tweet.reply[0]}: " #elif tweet.reply.len > 0: result = &"R to @{tweet.reply[0]}: "
#end if #end if
#result &= xmltree.escape(stripHtml(tweet.text)) #var text = stripHtml(tweet.text)
#if unicode.runeLen(text) > 32:
# text = unicode.runeSubStr(text, 0, 32) & "..."
#end if
#result &= xmltree.escape(text)
#if result.len > 0: return #if result.len > 0: return
#end if #end if
#if tweet.photos.len > 0: #if tweet.photos.len > 0:
@ -28,11 +32,10 @@ Twitter feed for: ${desc}. Generated by ${cfg.hostname}
#let tweet = tweet.retweet.get(tweet) #let tweet = tweet.retweet.get(tweet)
#let urlPrefix = getUrlPrefix(cfg) #let urlPrefix = getUrlPrefix(cfg)
#let text = replaceUrls(tweet.text, defaultPrefs, absolute=urlPrefix) #let text = replaceUrls(tweet.text, defaultPrefs, absolute=urlPrefix)
<p>${text.replace("\n", "<br>\n")}</p>
#if tweet.quote.isSome and get(tweet.quote).available: #if tweet.quote.isSome and get(tweet.quote).available:
# let quoteLink = getLink(get(tweet.quote)) # let quoteLink = getLink(get(tweet.quote))
<p>${text}<br><a href="${urlPrefix}${quoteLink}">${cfg.hostname}${quoteLink}</a></p> <p><a href="${urlPrefix}${quoteLink}">${cfg.hostname}${quoteLink}</a></p>
#else:
<p>${text}</p>
#end if #end if
#if tweet.photos.len > 0: #if tweet.photos.len > 0:
# for photo in tweet.photos: # for photo in tweet.photos: