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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Straightforward HTML document building. Write your HTML with the full power
//! of a programming language instead of creating messy and confusing
//! templates that contain typing errors.
//!
//! ## API example
//!
//! ```
//! use lewp_html::{api::*, LanguageTag, Script, DocumentExt, NodeExt};
//!
//! let valid_html = document(LanguageTag::parse("de-DE").unwrap(),
//! head(vec![
//! script(Script::Src("/my-javascript")),
//! script(Script::Inline("console.log(\"hello world!\");")),
//! link("text/css", "/static/css/main.css")
//! ]),
//! body(
//! vec![
//! h1(vec![text("Hello World")]),
//! p(vec![text("This is a paragraph!")])
//! .attrs(vec![
//! ("class", "prelude"),
//! ("id", "first-paragraph")
//! ]),
//! h2(vec![text("The elegant way to create a DOM!")]),
//! p(vec![text("Creating DOM has never been easier.")])
//! .attr("class", "highlighted")
//! ])
//! ).into_html();
//!
//! let expected_html = "<!DOCTYPE html><html lang=\"de\"><head><script src=\"/my-javascript\"></script><script>console.log(\"hello world!\");</script><link href=\"/static/css/main.css\" type=\"text/css\"></head><body><h1>Hello World</h1><p class=\"prelude\" id=\"first-paragraph\">This is a paragraph!</p><h2>The elegant way to create a DOM!</h2><p class=\"highlighted\">Creating DOM has never been easier.</p></body></html>";
//!
//! assert_eq!(&valid_html, expected_html);
//! ```
/// API function definitions to create your html document. See the API example
/// above.
pub use ;
/// A list of nodes.
pub type Nodes = ;
/// Error log with added prefix for this crate.