feat: add prettyplease vendored and get basic test working

This commit is contained in:
Jonathan Kelley committed 2022-04-24 02:55:20 -04:00
1 parent 794f43ffee
commit 2a1970b3a9
29 files changed
+4630 -10

No files matched your search

+26 -5
View File
@@ -191,21 +191,38 @@ impl ToTokens for Element {
pub enum ElementAttr {
/// attribute: "valuee {}"
AttrText { name: Ident, value: LitStr },
AttrText {
name: Ident,
value: LitStr,
},
/// attribute: true,
AttrExpression { name: Ident, value: Expr },
AttrExpression {
name: Ident,
value: Expr,
},
/// "attribute": "value {}"
CustomAttrText { name: LitStr, value: LitStr },
CustomAttrText {
name: LitStr,
value: LitStr,
},
/// "attribute": true,
CustomAttrExpression { name: LitStr, value: Expr },
CustomAttrExpression {
name: LitStr,
value: Expr,
},
// /// onclick: move |_| {}
// EventClosure { name: Ident, closure: ExprClosure },
/// onclick: {}
EventTokens { name: Ident, tokens: Expr },
EventTokens {
name: Ident,
tokens: Expr,
},
Meta(String),
}
pub struct ElementAttrNamed {
@@ -248,6 +265,10 @@ impl ToTokens for ElementAttrNamed {
dioxus_elements::on::#name(__cx, #tokens)
}
}
ElementAttr::Meta(_) => {
todo!("meta attributes not supported yet");
}
});
}
}
-2
View File
@@ -18,8 +18,6 @@ mod component;
mod element;
mod node;
pub mod pretty;
// Re-export the namespaces into each other
pub use component::*;
pub use element::*;
+2
View File
@@ -20,6 +20,7 @@ pub enum BodyNode {
Component(Component),
Text(LitStr),
RawExpr(Expr),
Meta(String),
}
impl Parse for BodyNode {
@@ -79,6 +80,7 @@ impl ToTokens for BodyNode {
BodyNode::RawExpr(exp) => tokens.append_all(quote! {
__cx.fragment_from_iter(#exp)
}),
BodyNode::Meta(_) => {}
}
}
}
-1
View File
@@ -1 +0,0 @@
//! pretty printer for rsx!