Skip to content

Commit 1e3043e

Browse files
committed
some more changes
1 parent f13e65c commit 1e3043e

File tree

3 files changed

+36
-35
lines changed

3 files changed

+36
-35
lines changed

hypertext-macros/src/html/generate.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,13 @@ impl ToTokens for Checks {
266266
#[allow(unused_imports)]
267267
use html_elements::*;
268268

269-
const _: () = {
270-
#[doc(hidden)]
271-
const fn check_element<
272-
T: ::hypertext::validation::Element<Kind = K>,
273-
K: ::hypertext::validation::ElementKind
274-
>() {}
275-
276-
#(#checks)*
277-
};
269+
#[doc(hidden)]
270+
const fn check_element<
271+
T: ::hypertext::validation::Element<Kind = K>,
272+
K: ::hypertext::validation::ElementKind
273+
>() {}
274+
275+
#(#checks)*
278276
};
279277
}
280278
.to_tokens(tokens);

hypertext/src/lib.rs

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,37 +54,40 @@
5454
//! # .render(),
5555
//!
5656
//! // 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+
//! }
5767
//!
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;
6670
//!
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;
7173
//!
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>");
7281
//! 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);
8286
//! hypertext_output.push_str("</p>");
8387
//! }
84-
//!
85-
//! hypertext_output.push_str("</div>");
86-
//! })
87-
//! }
88+
//! }
89+
//! hypertext_output.push_str("</div>");
90+
//! })
8891
//! # .render());
8992
//! ```
9093
//!

hypertext/src/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
pub use crate::{
1212
AttributeRenderable, Renderable, RenderableExt, Rendered, attribute, component, maud, rsx,
1313
};
14-
pub use crate::{frameworks::*, html_elements, validation::GlobalAttributes};
14+
pub use crate::{frameworks::*, html_elements, validation::global_traits::*};

0 commit comments

Comments
 (0)