~( Hatter: A x̷̨̼͕͖̼͆͑̈̈́́̈́̓̓͊̐́͋̈̈́̐͗́̂̆̄̑̚͝x̶̢̬͚̥̬̦͇̑̀͗͜͜x̸̛̮͎͉̩̰̥̳͓̥͕̱͓͕̩̻̬̙̹̀̿̋̏́́̐̋̈́̔̓͆͛͊̾͋̍̚͝͠͠x̵̧̥̜̅̋̇͋̈́͑̄̾͒̔̑ HyperText Library )
Hatter is a slightly mad, zero dependency HTML template library.
If you are looking for any of the following:
- Blazing fast speed
- Templates that compile to Rust
- Generating HTML from Rust code
- Type safety
Then you are in the wrong place!
Hatter is an HTML template library that can only do a few things:
- Print values (
bool,string,i32) - Run helper functions
- Loop over a
VecorHashMap if/else
That's it. You should definitely be using a different template library.
~( printing values )
let mut env = new;
env.set;
let html = env.render?;
~( name )
Or the shorthand version, for variables only:
~name
~( helper functions )
let mut env = new;
env.set;
env.set;
env.helper;
env.render;
According to my calculations, ~a + ~b = ~( add(a, b) )!
~( looping )
let mut env = new;
let mut pages = vec!;
env.set;
env.helper;
let html = env.render?;
~( for page in pages )
~( to_title(page) )
~( end )
~( conditionals )
let mut env = new;
let mut pages = vec!;
let mut map = new;
map.insert;
env.set;
env.helper
let html = env.render?;
~( if logged_in? )
~( user.name )
~( else )
Log in
~( end )
All together now
let mut env = new;
env.set;
env.set;
env.helper;
let mut user = new;
user.insert;
user.insert;
env.set;
let out = env.render?;
println!;