fix formatted strings in components

This commit is contained in:
Evan Almloff committed 2024-01-16 12:47:23 -06:00
1 parent 407a82588a
commit 90d0164b9e
8 files changed
+41 -59

No files matched your search

+2 -2
View File
@@ -211,7 +211,7 @@ impl ToTokens for ElementAttrValue {
fn to_tokens(&self, tokens: &mut TokenStream2) {
match self {
ElementAttrValue::Shorthand(i) => tokens.append_all(quote! { #i }),
ElementAttrValue::AttrLiteral(lit) => tokens.append_all(quote! { #lit }),
ElementAttrValue::AttrLiteral(lit) => tokens.append_all(quote! { #lit.to_string() }),
ElementAttrValue::AttrOptionalExpr { condition, value } => {
tokens.append_all(quote! { if #condition { Some(#value) } else { None } })
}
@@ -224,7 +224,7 @@ impl ToTokens for ElementAttrValue {
impl ElementAttrValue {
fn to_str_expr(&self) -> Option<TokenStream2> {
match self {
ElementAttrValue::AttrLiteral(lit) => Some(quote!(#lit)),
ElementAttrValue::AttrLiteral(lit) => Some(quote!(#lit.to_string())),
ElementAttrValue::AttrOptionalExpr { value, .. } => value.to_str_expr(),
ElementAttrValue::AttrExpr(expr) => Some(quote!(#expr.to_string())),
_ => None,