#![allow(unused_imports)]
use handbar::Handbar;
use std::error::Error;
#[macro_use]
extern crate serde_json;
fn main() -> Result<(), Box<dyn Error>> {
let mut handbar = Handbar::new();
handbar.register_template_file("tpl", "./examples/script/template.hbs")?;
handbar.register_script_helper_file("score", "./examples/script/goals.rhai")?;
let data = json! {[
[{
"name": "Dortmund",
"goals": ["Haaland", "Guerreiro", "Hazard", "Guerreiro"]
}, {
"name": "Schalke",
"goals": []
}],
[{
"name": "RB Leipzig",
"goals": ["Poulsen"]
}, {
"name": "SC Feriburg",
"goals": ["Gulde"]
}]
]};
println!("{}", handbar.render("tpl", &data)?);
Ok(())
}