mirror of
https://github.com/soywod/himalaya.git
synced 2024-09-29 04:31:11 +00:00
remove blank lines and spaces from plain parts (#280)
This commit is contained in:
parent
b6669fba57
commit
1dbd7a4893
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Vim plugin get focused msg id [#268]
|
||||
- Nix run issue [#272]
|
||||
- Range not displayed when fetch fails [#276]
|
||||
- Blank lines and spaces in `text/plain` parts [#280]
|
||||
|
||||
### Removed
|
||||
|
||||
|
@ -372,3 +373,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
[#272]: https://github.com/soywod/himalaya/issues/272
|
||||
[#273]: https://github.com/soywod/himalaya/issues/273
|
||||
[#276]: https://github.com/soywod/himalaya/issues/276
|
||||
[#280]: https://github.com/soywod/himalaya/issues/280
|
||||
|
|
|
@ -106,15 +106,21 @@ impl Msg {
|
|||
.replace_all(&sanitized_html, " ")
|
||||
.to_string();
|
||||
// Merge new line chars
|
||||
let sanitized_html = Regex::new(r"(\r?\n ?){2,}")
|
||||
let sanitized_html = Regex::new(r"(\r?\n *){2,}")
|
||||
.unwrap()
|
||||
.replace_all(&sanitized_html, "\n\n")
|
||||
.to_string();
|
||||
// Decode HTML entities
|
||||
let sanitized_html = html_escape::decode_html_entities(&sanitized_html).to_string();
|
||||
|
||||
sanitized_html
|
||||
} else {
|
||||
plain
|
||||
let sanitized_plain = Regex::new(r"(\r?\n *){2,}")
|
||||
.unwrap()
|
||||
.replace_all(&plain, "\n\n")
|
||||
.to_string();
|
||||
|
||||
sanitized_plain
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue