fix fmt escape sequences in static attribute/text nodes
@@ -182,7 +182,7 @@ impl<'a> DynamicContext<'a> {
let static_attrs = el.attributes.iter().map(|attr| match &attr.attr {
ElementAttr::AttrText { name, value } if value.is_static() => {
- let value = value.source.as_ref().unwrap();
+ if let Some(value) = value.to_static() {
quote! {
::dioxus::core::TemplateAttribute::Static {
name: dioxus_elements::#el_name::#name.0,
@@ -193,10 +193,13 @@ impl<'a> DynamicContext<'a> {
// volatile: dioxus_elements::#el_name::#name.2,
}
}
+ } else {
+ unreachable!()
+ }
}
ElementAttr::CustomAttrText { name, value } if value.is_static() => {
- let value = value.source.as_ref().unwrap();
+ if let Some(value) = value.to_static() {
quote! {
::dioxus::core::TemplateAttribute::Static {
name: #name,
@@ -207,6 +210,9 @@ impl<'a> DynamicContext<'a> {
// volatile: dioxus_elements::#el_name::#name.2,
}
}
+ } else {
+ unreachable!()
+ }
}
ElementAttr::AttrExpression { .. }
@@ -244,8 +250,11 @@ impl<'a> DynamicContext<'a> {
}
BodyNode::Text(text) if text.is_static() => {
- let text = text.source.as_ref().unwrap();
+ if let Some(text) = text.to_static() {
quote! { ::dioxus::core::TemplateNode::Text{ text: #text } }
+ } else {
+ unreachable!()
+ }
}
BodyNode::RawExpr(_)
