xhtml: Add a tree generation example.
This commit is contained in:
parent
7ebfe3e881
commit
2f45d586b5
1 changed files with 15 additions and 0 deletions
15
src/xhtml.rs
15
src/xhtml.rs
|
@ -469,4 +469,19 @@ mod tests {
|
||||||
let html = xhtml_im.to_html();
|
let html = xhtml_im.to_html();
|
||||||
assert_eq!(html, "<p>Hello <strong>world</strong>!</p>");
|
assert_eq!(html, "<p>Hello <strong>world</strong>!</p>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn generate_tree() {
|
||||||
|
let world = "world".to_string();
|
||||||
|
|
||||||
|
Body { style: vec![], xml_lang: Some("en".to_string()), children: vec![
|
||||||
|
Child::Tag(Tag::P { style: vec![], children: vec![
|
||||||
|
Child::Text("Hello ".to_string()),
|
||||||
|
Child::Tag(Tag::Strong { children: vec![
|
||||||
|
Child::Text(world),
|
||||||
|
] }),
|
||||||
|
Child::Text("!".to_string()),
|
||||||
|
] }),
|
||||||
|
] };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue