Not a Template Engine

This is not a template engine, but sugar to implicitly call write!(…) like in PHP. The only difference is that the output gets XML escaped automatically unless opted-out explicitly.

E.g.

No new traits are introduced, instead using #[derive(Nate)] works by implementing fmt::Display. This also makes nesting of NaTE templates possible.

A more complex example would be:

Inside of a {% code block %} you can write any and all rust code.

Values in {{ value blocks }} are printed XML escaped.

Values in {{{ raw blocks }}} are printed verbatim.

For values in {{{{ debug blocks }}}} their debug message is printed as in "{:?}".

For values in {{{{{ verbose blocks }}}}} their debug message is printed verbose as in "{:#?}".

Using hyphens - at the start/end of a block, whitespaces before/after the block are trimmed.

Data sections {{…}} to {{{{{…}}}}} must not be empty. Code blocks and comment sections may be empty.

Sections don't need to be closed at the end of the file.

To debug any errors you can add an argument as in #[template(output = "some/path/generated.rs")]. The generated code is stored in there even if there were parsing errors in the Rust code. The path is relative to the project root (where your Cargo.toml lives).