Dojang is a Html template engine, as a drop in replacement for EJS. Though it does not supports 100% of the javascript syntax, it supports enough to cover the basic usages.
```rust use dojang::Dojang; use serde_json::Value;
// Create a template engine Dojang. let mut dojang = Dojang::new();
// Load template file under '/my/template/files' assert!(dojang.load("/my/template/files").is_ok());
// Render a template. "sometemplate" is the one of the template file under /my/template/files. // Note that the context should be provided as a serdejson value. asserteq!( dojang .render( "sometemplate", serdejson::fromstr(r#"{ "a" : 1 }"#).unwrap() ) .unwrap(), " Hi " );
asserteq!( dojang .render( "sometemplate", serdejson::fromstr(r#"{ "a" : 2 }"#).unwrap() ) .unwrap(), "2" ); ```