Made some feeds look less bloated by finally removing double line breaks.

This commit is contained in:
mdosch 2019-05-26 23:53:18 +02:00
parent 7193b274c1
commit c111da9c8c

View file

@ -221,15 +221,18 @@ func getArticles(feedURL string, max int, noExcerpt bool) (string, error) {
}
}
// To make the message look not so bloated we remove multiple newlines.
// Split the article description/content into fragments between newlines.
fragments := strings.Split(description, "\n")
// Remove lines only consisting of "> "; thank you reddit.
description = strings.Replace(description, "> \n", "", -1)
// To make the message look not so bloated we remove double newlines.
// Split the article description/content into fragments between double newlines.
fragments := strings.Split(description, "\n\n")
// Empty article description/content
description = ""
// Fill article description/content with the fragments separated by one newline.
for _, line := range fragments {
// Only if the only content is not "> ", thank you reddit.
if line != "> " {
// Only if the only content is not empty.
if line != "" {
description = description + line + "\n"
}
}