Fix errant newlines when parsing matrix HTML
parent
d654bbf512
commit
13dc88f830
|
@ -53,7 +53,8 @@ pub fn convert_matrix(message: &str) -> MessageContent {
|
||||||
NodeEdge::End(node) => match node.data() {
|
NodeEdge::End(node) => match node.data() {
|
||||||
NodeData::Text(text) => {
|
NodeData::Text(text) => {
|
||||||
if !skip_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) => {
|
NodeData::Element(element) => {
|
||||||
|
@ -96,7 +97,7 @@ pub fn convert_matrix(message: &str) -> MessageContent {
|
||||||
components = parent_components;
|
components = parent_components;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local_name!("br") => {
|
local_name!("br") | local_name!("p") => {
|
||||||
components.push(MessageComponent::HardBreak);
|
components.push(MessageComponent::HardBreak);
|
||||||
}
|
}
|
||||||
local_name!("blockquote") => {
|
local_name!("blockquote") => {
|
||||||
|
|
Loading…
Reference in New Issue