-
Notifications
You must be signed in to change notification settings - Fork 164
Open
Labels
context aware escapingThis feature depends on Maud treating certain elements and attributes in a special wayThis feature depends on Maud treating certain elements and attributes in a special way
Description
#444 from @BadMannersXYZ got me thinking. I currently use maud like JSX, in that I define components like this:
fn my_custom_form(...) -> Markup { html! { form { .. } } }
// later
fn main_view() -> Markup {
html! {
(my_custom_form())
}
}In React-land, I'd write:
<MyCustomForm />Now my problem is that I'd like to add custom classes and attributes to my "component" from the caller side. <form class="foobar"> for example. In JSX, I'd write:
<MyCustomForm className="foobar" />And the MyCustomForm would forward all props to the underlying form element.
How about this API in Rust?
fn my_custom_form(attrs: maud::Attributes) -> Markup {
html! {
form (..attrs) { .. }
}
}
fn main_view() -> Markup {
html! {
(my_custom_form(maud::attributes!(.foobar)))
}
}maud could expose alternative ways to construct maud::Attributes as well, and solve usecases related to #444 as well in one go.
nmabhinandan, tgrosinger, BadMannersXYZ, nbruchmann, biruburu and 3 more
Metadata
Metadata
Assignees
Labels
context aware escapingThis feature depends on Maud treating certain elements and attributes in a special wayThis feature depends on Maud treating certain elements and attributes in a special way