1#![doc = include_str!("../README.md")]
2
3extern crate proc_macro;
4use proc_macro::TokenStream;
5
6mod args;
7mod codegen;
8mod sink;
9mod html_element;
10#[cfg(feature = "i18n")]
11mod i18n;
12mod text_part;
13mod config;
14mod helper;
15pub(crate) use {
16 crate::args::*,
17 crate::codegen::*,
18 crate::sink::*,
19 crate::html_element::*,
20 crate::config::*,
21 crate::text_part::*,
22 crate::helper::*,
23 proc_macro_error::*,
24 string_tools::*,
25 std::collections::HashMap,
26};
27#[cfg(feature = "i18n")]
28pub(crate) use crate::i18n::*;
29
30#[proc_macro]
38#[proc_macro_error]
39pub fn template_html(args: TokenStream) -> TokenStream {
40 let args = parse_args(args);
41 let root = read_template(&args);
42 #[cfg(feature = "i18n")]
43 generate_pot(&root, &args);
44 let code = generate_code(root, args);
45 #[cfg(feature = "log")]
46 println!("{code}");
47 code.parse().unwrap()
48}