aboutsummaryrefslogtreecommitdiffstats
path: root/document_tree/src/lib.rs
blob: 91547253b379157174006acb9217f4dcbe7dfd9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
generated by cgit v1.2.3 (git 2.25.1) at 2025-10-31 14:51:05 +0000
 


d::default::Default;

	#[test]
	fn imperative() {
		let mut doc = Document::default();
		let mut title = Title::default();
		let url = "https://example.com/image.jpg".parse().unwrap();
		let image = ImageInline::with_extra(extra_attributes::ImageInline::new(url));
		title.append_child("Hi");
		title.append_child(image);
		doc.append_child(title);

		println!("{:?}", doc);
	}

	#[test]
	fn descriptive() {
		let doc = Document::with_children(vec![
			Title::with_children(vec![
				"Hi".into(),
				ImageInline::with_extra(extra_attributes::ImageInline::new(
					"https://example.com/image.jpg".parse().unwrap()
				)).into(),
			]).into()
		]);

		println!("{:?}", doc);
	}
}