mirror of
https://salsa.debian.org/mdosch/feed-to-muc.git
synced 2024-11-22 14:08:39 +01:00
Made some feeds look less bloated by finally removing double line breaks.
This commit is contained in:
parent
7193b274c1
commit
c111da9c8c
1 changed files with 8 additions and 5 deletions
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue