From 0331b763ffa845f3cb7b9651ca70ab8b407eb67e Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 10 Oct 2019 10:32:47 +0100 Subject: refactor multi-line-to-line normalisation to utils.parse.line_normalise(), use it in rss.py closes #174 --- modules/tweets/format.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'modules/tweets') diff --git a/modules/tweets/format.py b/modules/tweets/format.py index 8b84cba3..4d64dffd 100644 --- a/modules/tweets/format.py +++ b/modules/tweets/format.py @@ -7,11 +7,7 @@ def _timestamp(dt): return "%s %s ago" % (since, unit) def _normalise(tweet): - while " " in tweet: - tweet = tweet.replace(" ", " ") - lines = [line.strip() for line in tweet.split("\n")] - lines = list(filter(None, lines)) - return html.unescape(" ".join(lines)) + return html.unescape(utils.parse.line_normalise(tweet)) def _tweet(exports, server, tweet, from_url): linked_id = tweet.id -- cgit v1.3.1-10-gc9f91