1
1
#? stdtmpl(subsChar = '$', metaChar = '#')
2
2
## SPDX-License-Identifier: AGPL-3.0-only
3
- #import strutils, xmltree, strformat, options
3
+ #import strutils, xmltree, strformat, options, unicode
4
4
#import ../types, ../utils, ../formatters, ../prefs
5
5
#
6
6
#proc getTitle(tweet: Tweet; retweet: string): string =
7
7
#if tweet.pinned: result = "Pinned: "
8
8
#elif retweet.len > 0: result = &"RT by @{retweet}: "
9
9
#elif tweet.reply.len > 0: result = &"R to @{tweet.reply[0]}: "
10
10
#end if
11
- #result &= xmltree.escape(stripHtml(tweet.text))
11
+ #var text = stripHtml(tweet.text)
12
+ #if unicode.runeLen(text) > 32:
13
+ # text = unicode.runeSubStr(text, 0, 32) & "..."
14
+ #end if
15
+ #result &= xmltree.escape(text)
12
16
#if result.len > 0: return
13
17
#end if
14
18
#if tweet.photos.len > 0:
@@ -28,11 +32,10 @@ Twitter feed for: ${desc}. Generated by ${cfg.hostname}
28
32
#let tweet = tweet.retweet.get(tweet)
29
33
#let urlPrefix = getUrlPrefix(cfg)
30
34
#let text = replaceUrls(tweet.text, defaultPrefs, absolute=urlPrefix)
35
+ <p>${text.replace("\n", "<br>\n")}</p>
31
36
#if tweet.quote.isSome and get(tweet.quote).available:
32
37
# let quoteLink = getLink(get(tweet.quote))
33
- <p>${text}<br><a href="${urlPrefix}${quoteLink}">${cfg.hostname}${quoteLink}</a></p>
34
- #else:
35
- <p>${text}</p>
38
+ <p><a href="${urlPrefix}${quoteLink}">${cfg.hostname}${quoteLink}</a></p>
36
39
#end if
37
40
#if tweet.photos.len > 0:
38
41
# for photo in tweet.photos:
0 commit comments