mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
This commit is contained in:
parent
41f3c46830
commit
b79037b96f
1 changed files with 14 additions and 6 deletions
|
@ -78,12 +78,20 @@ impl ViewMacros {
|
|||
for view in visitor.views {
|
||||
let span = view.span();
|
||||
let id = span_to_stable_id(path, span.start().line);
|
||||
let tokens = view.tokens.clone().into_iter();
|
||||
// TODO handle class = ...
|
||||
let rsx =
|
||||
rstml::parse2(tokens.collect::<proc_macro2::TokenStream>())?;
|
||||
let template = LNode::parse_view(rsx)?;
|
||||
views.push(MacroInvocation { id, template });
|
||||
if view.tokens.is_empty() {
|
||||
views.push(MacroInvocation {
|
||||
id,
|
||||
template: LNode::Fragment(Vec::new()),
|
||||
});
|
||||
} else {
|
||||
let tokens = view.tokens.clone().into_iter();
|
||||
// TODO handle class = ...
|
||||
let rsx = rstml::parse2(
|
||||
tokens.collect::<proc_macro2::TokenStream>(),
|
||||
)?;
|
||||
let template = LNode::parse_view(rsx)?;
|
||||
views.push(MacroInvocation { id, template });
|
||||
}
|
||||
}
|
||||
Ok(views)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue