fix raw attribute names (#2520)
This commit is contained in:
1 parent
f4a62fad6b
commit
f042e0029c
1 file changed
+67
-27
@@ -95,38 +95,19 @@ macro_rules! mod_methods {
|
|||||||
$fn_html_to_rsx:ident;
|
$fn_html_to_rsx:ident;
|
||||||
$(
|
$(
|
||||||
$(#[$attr:meta])*
|
$(#[$attr:meta])*
|
||||||
$name:ident $(: $js_name:literal)? $(in $ns:literal)?;
|
$name:ident $(: $(no-$alias:ident)? $js_name:literal)? $(in $ns:literal)?;
|
||||||
)+
|
)+
|
||||||
) => {
|
) => {
|
||||||
$(#[$mod_attr])*
|
$(#[$mod_attr])*
|
||||||
pub mod $mod {
|
pub mod $mod {
|
||||||
use super::*;
|
use super::*;
|
||||||
$(
|
$(
|
||||||
$(#[$attr])*
|
mod_methods! {
|
||||||
///
|
@attr
|
||||||
/// ## Usage in rsx
|
$(#[$attr])*
|
||||||
///
|
$name $(: $(no-$alias)? $js_name)? $(in $ns)?;
|
||||||
/// ```rust, ignore
|
}
|
||||||
/// # use dioxus::prelude::*;
|
)+
|
||||||
#[doc = concat!("let ", stringify!($name), " = \"value\";")]
|
|
||||||
///
|
|
||||||
/// rsx! {
|
|
||||||
/// // Attributes need to be under the element they modify
|
|
||||||
/// div {
|
|
||||||
/// // Attributes are followed by a colon and then the value of the attribute
|
|
||||||
#[doc = concat!(" ", stringify!($name), ": \"value\"")]
|
|
||||||
/// }
|
|
||||||
/// div {
|
|
||||||
/// // Or you can use the shorthand syntax if you have a variable in scope that has the same name as the attribute
|
|
||||||
#[doc = concat!(" ", stringify!($name), ",")]
|
|
||||||
/// }
|
|
||||||
/// };
|
|
||||||
/// ```
|
|
||||||
$(
|
|
||||||
#[doc(alias = $js_name)]
|
|
||||||
)?
|
|
||||||
pub const $name: AttributeDiscription = mod_methods! { $name $(: $js_name)? $(in $ns)?; };
|
|
||||||
)*
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "hot-reload-context")]
|
#[cfg(feature = "hot-reload-context")]
|
||||||
@@ -155,6 +136,65 @@ macro_rules! mod_methods {
|
|||||||
impl_extension_attributes![$mod { $($name,)* }];
|
impl_extension_attributes![$mod { $($name,)* }];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(
|
||||||
|
@attr
|
||||||
|
$(#[$attr:meta])*
|
||||||
|
$name:ident $(: no-alias $js_name:literal)? $(in $ns:literal)?;
|
||||||
|
) => {
|
||||||
|
$(#[$attr])*
|
||||||
|
///
|
||||||
|
/// ## Usage in rsx
|
||||||
|
///
|
||||||
|
/// ```rust, ignore
|
||||||
|
/// # use dioxus::prelude::*;
|
||||||
|
#[doc = concat!("let ", stringify!($name), " = \"value\";")]
|
||||||
|
///
|
||||||
|
/// rsx! {
|
||||||
|
/// // Attributes need to be under the element they modify
|
||||||
|
/// div {
|
||||||
|
/// // Attributes are followed by a colon and then the value of the attribute
|
||||||
|
#[doc = concat!(" ", stringify!($name), ": \"value\"")]
|
||||||
|
/// }
|
||||||
|
/// div {
|
||||||
|
/// // Or you can use the shorthand syntax if you have a variable in scope that has the same name as the attribute
|
||||||
|
#[doc = concat!(" ", stringify!($name), ",")]
|
||||||
|
/// }
|
||||||
|
/// };
|
||||||
|
/// ```
|
||||||
|
pub const $name: AttributeDiscription = mod_methods! { $name $(: $js_name)? $(in $ns)?; };
|
||||||
|
};
|
||||||
|
|
||||||
|
(
|
||||||
|
@attr
|
||||||
|
$(#[$attr:meta])*
|
||||||
|
$name:ident $(: $js_name:literal)? $(in $ns:literal)?;
|
||||||
|
) => {
|
||||||
|
$(#[$attr])*
|
||||||
|
///
|
||||||
|
/// ## Usage in rsx
|
||||||
|
///
|
||||||
|
/// ```rust, ignore
|
||||||
|
/// # use dioxus::prelude::*;
|
||||||
|
#[doc = concat!("let ", stringify!($name), " = \"value\";")]
|
||||||
|
///
|
||||||
|
/// rsx! {
|
||||||
|
/// // Attributes need to be under the element they modify
|
||||||
|
/// div {
|
||||||
|
/// // Attributes are followed by a colon and then the value of the attribute
|
||||||
|
#[doc = concat!(" ", stringify!($name), ": \"value\"")]
|
||||||
|
/// }
|
||||||
|
/// div {
|
||||||
|
/// // Or you can use the shorthand syntax if you have a variable in scope that has the same name as the attribute
|
||||||
|
#[doc = concat!(" ", stringify!($name), ",")]
|
||||||
|
/// }
|
||||||
|
/// };
|
||||||
|
/// ```
|
||||||
|
$(
|
||||||
|
#[doc(alias = $js_name)]
|
||||||
|
)?
|
||||||
|
pub const $name: AttributeDiscription = mod_methods! { $name $(: $js_name)? $(in $ns)?; };
|
||||||
|
};
|
||||||
|
|
||||||
// Rename the incoming ident and apply a custom namespace
|
// Rename the incoming ident and apply a custom namespace
|
||||||
( $name:ident: $lit:literal in $ns:literal; ) => { ($lit, Some($ns), false) };
|
( $name:ident: $lit:literal in $ns:literal; ) => { ($lit, Some($ns), false) };
|
||||||
|
|
||||||
@@ -2346,7 +2386,7 @@ mod_methods! {
|
|||||||
transform_origin: "transform-origin";
|
transform_origin: "transform-origin";
|
||||||
|
|
||||||
/// <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/type>
|
/// <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/type>
|
||||||
r#type;
|
r#type: no-alias "type";
|
||||||
|
|
||||||
/// <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/u1>
|
/// <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/u1>
|
||||||
u1;
|
u1;
|
||||||
|
|||||||
Reference in new issue
Block a user