tidos_macro 0.7.2

Procedural macros for the Tidos component framework.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::tokens::Content;
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};

impl ToTokens for Content {
	fn to_tokens(&self, tokens: &mut TokenStream) {
		match self {
			Content::Tag(html_tag) => html_tag.to_tokens(tokens),
			Content::ControlTag(control_tag) => control_tag.to_tokens(tokens),
			Content::Literal(literal) => literal.to_tokens(tokens),
			Content::Expression(expr) => quote!(tidos::sanitize!(#expr)).to_tokens(tokens),
			Content::RawHTMLExpression(expr) => quote!(&#expr).to_tokens(tokens),
		}
	}
}