From 9c19e70a03b1ad9cf6a2923b945fcfb7dbe233d8 Mon Sep 17 00:00:00 2001 From: Faye Duxovni Date: Wed, 21 Jul 2021 18:57:13 -0400 Subject: [PATCH] truncate tweet text for titles of rss feed items --- src/views/rss.nimf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/rss.nimf b/src/views/rss.nimf index b6db2b2..0368bfd 100644 --- a/src/views/rss.nimf +++ b/src/views/rss.nimf @@ -1,5 +1,5 @@ #? stdtmpl(subsChar = '$', metaChad = '#') -#import strutils, xmltree, strformat, options +#import strutils, xmltree, strformat, options, unicode #import ../types, ../utils, ../formatters # #proc getTitle(tweet: Tweet; prefs: Prefs; retweet: string): string = @@ -7,7 +7,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: