Fix errant newlines when parsing matrix HTML

legacy
Charlotte Som 2021-09-12 23:39:15 +01:00
parent d654bbf512
commit 13dc88f830
1 changed files with 3 additions and 2 deletions

View File

@ -53,7 +53,8 @@ pub fn convert_matrix(message: &str) -> MessageContent {
NodeEdge::End(node) => match node.data() {
NodeData::Text(text) => {
if !skip_text {
components.push(MessageComponent::Plain(text.borrow().clone()));
let text = text.borrow().lines().collect::<Vec<_>>().join(" ");
components.push(MessageComponent::Plain(text));
}
}
NodeData::Element(element) => {
@ -96,7 +97,7 @@ pub fn convert_matrix(message: &str) -> MessageContent {
components = parent_components;
}
}
local_name!("br") => {
local_name!("br") | local_name!("p") => {
components.push(MessageComponent::HardBreak);
}
local_name!("blockquote") => {