mirror of
https://salsa.debian.org/mdosch/feed-to-muc.git
synced 2024-11-22 22:18: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.
|
// Remove lines only consisting of "> "; thank you reddit.
|
||||||
// Split the article description/content into fragments between newlines.
|
description = strings.Replace(description, "> \n", "", -1)
|
||||||
fragments := strings.Split(description, "\n")
|
|
||||||
|
// 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
|
// Empty article description/content
|
||||||
description = ""
|
description = ""
|
||||||
// Fill article description/content with the fragments separated by one newline.
|
// Fill article description/content with the fragments separated by one newline.
|
||||||
for _, line := range fragments {
|
for _, line := range fragments {
|
||||||
// Only if the only content is not "> ", thank you reddit.
|
// Only if the only content is not empty.
|
||||||
if line != "> " {
|
if line != "" {
|
||||||
description = description + line + "\n"
|
description = description + line + "\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue