mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-20 05:39:52 -07:00
HTML self-closing tags are getting parsed incorrectly (#63)
This commit is contained in:
parent
0bc4ff07b0
commit
e6cdd02f22
1 changed files with 12 additions and 1 deletions
|
@ -619,7 +619,7 @@ pub fn parse_matrix_html(s: &str) -> StyleTree {
|
||||||
let dom = parse_fragment(
|
let dom = parse_fragment(
|
||||||
RcDom::default(),
|
RcDom::default(),
|
||||||
ParseOpts::default(),
|
ParseOpts::default(),
|
||||||
QualName::new(None, ns!(), local_name!("div")),
|
QualName::new(None, ns!(html), local_name!("body")),
|
||||||
vec![],
|
vec![],
|
||||||
)
|
)
|
||||||
.one(StrTendril::from(s));
|
.one(StrTendril::from(s));
|
||||||
|
@ -1147,4 +1147,15 @@ pub mod tests {
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_self_closing() {
|
||||||
|
let s = "Hello<br>World<br>Goodbye";
|
||||||
|
let tree = parse_matrix_html(s);
|
||||||
|
let text = tree.to_text(7, Style::default(), true);
|
||||||
|
assert_eq!(text.lines.len(), 3);
|
||||||
|
assert_eq!(text.lines[0], Spans(vec![Span::raw("Hello"), Span::raw(" "),]));
|
||||||
|
assert_eq!(text.lines[1], Spans(vec![Span::raw("World"), Span::raw(" "),]));
|
||||||
|
assert_eq!(text.lines[2], Spans(vec![Span::raw("Goodbye")]),);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue