|
54 | 54 | //! # .render(), |
55 | 55 | //! |
56 | 56 | //! // expands to (roughly): |
| 57 | +//! hypertext::Lazy(move |hypertext_output: &mut hypertext::String| { |
| 58 | +//! const _: () = { |
| 59 | +//! use html_elements::*; |
| 60 | +//! |
| 61 | +//! #[doc(hidden)] |
| 62 | +//! const fn check_element< |
| 63 | +//! T: hypertext::validation::Element<Kind = K>, |
| 64 | +//! K: hypertext::validation::ElementKind, |
| 65 | +//! >() { |
| 66 | +//! } |
57 | 67 | //! |
58 | | -//! { |
59 | | -//! const _: fn() = || { |
60 | | -//! html_elements::div; |
61 | | -//! html_elements::h1; |
62 | | -//! let _: hypertext::validation::Attribute = html_elements::div::id; |
63 | | -//! let _: hypertext::validation::Attribute = html_elements::div::title; |
64 | | -//! let _: hypertext::validation::Attribute = html_elements::h1::class; |
65 | | -//! }; |
| 68 | +//! check_element::<h1, hypertext::validation::Normal>(); |
| 69 | +//! let _: hypertext::validation::Attribute = h1::class; |
66 | 70 | //! |
67 | | -//! hypertext::Lazy(|hypertext_output: &mut String| { |
68 | | -//! hypertext_output.push_str( |
69 | | -//! r#"<div id="main" title="Main Div"><h1 class="important">Hello, world!</h1>"#, |
70 | | -//! ); |
| 71 | +//! check_element::<p, hypertext::validation::Normal>(); |
| 72 | +//! let _: hypertext::validation::Attribute = p::class; |
71 | 73 | //! |
| 74 | +//! check_element::<div, hypertext::validation::Normal>(); |
| 75 | +//! let _: hypertext::validation::Attribute = div::id; |
| 76 | +//! let _: hypertext::validation::Attribute = div::title; |
| 77 | +//! }; |
| 78 | +//! hypertext_output.push_str("<div id=\"main\" title=\"Main Div\">"); |
| 79 | +//! { |
| 80 | +//! hypertext_output.push_str("<h1 class=\"important\">Hello, world!</h1>"); |
72 | 81 | //! for i in 1..=3 { |
73 | | -//! const _: fn() = || { |
74 | | -//! html_elements::p; |
75 | | -//! let _: hypertext::validation::Attribute = html_elements::p::class; |
76 | | -//! }; |
77 | | -//! |
78 | | -//! hypertext_output.push_str(r#"<p class="p-"#); |
79 | | -//! i.render_to(hypertext_output); |
80 | | -//! hypertext_output.push_str(r#"">This is paragraph number "#); |
81 | | -//! i.render_to(hypertext_output); |
| 82 | +//! hypertext_output.push_str("<p class=\"p-"); |
| 83 | +//! hypertext::AttributeRenderable::render_attribute_to(&i, hypertext_output); |
| 84 | +//! hypertext_output.push_str("\">This is paragraph number "); |
| 85 | +//! hypertext::Renderable::render_to(&i, hypertext_output); |
82 | 86 | //! hypertext_output.push_str("</p>"); |
83 | 87 | //! } |
84 | | -//! |
85 | | -//! hypertext_output.push_str("</div>"); |
86 | | -//! }) |
87 | | -//! } |
| 88 | +//! } |
| 89 | +//! hypertext_output.push_str("</div>"); |
| 90 | +//! }) |
88 | 91 | //! # .render()); |
89 | 92 | //! ``` |
90 | 93 | //! |
|
0 commit comments