truncate tweet text for titles of rss feed items

This commit is contained in:
Faye Duxovni 2021-07-21 18:57:13 -04:00
parent 26842fa0bf
commit 9c19e70a03

View file

@ -1,5 +1,5 @@
#? stdtmpl(subsChar = '$', metaChad = '#') #? stdtmpl(subsChar = '$', metaChad = '#')
#import strutils, xmltree, strformat, options #import strutils, xmltree, strformat, options, unicode
#import ../types, ../utils, ../formatters #import ../types, ../utils, ../formatters
# #
#proc getTitle(tweet: Tweet; prefs: Prefs; retweet: string): string = #proc getTitle(tweet: Tweet; prefs: Prefs; retweet: string): string =
@ -7,7 +7,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: