Merge branch 'nicer-rss'

This commit is contained in:
Zed 2021-12-30 02:22:39 +01:00
commit 173dd8f016
1 changed files with 8 additions and 5 deletions

View File

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