Rendering spans
This commit is contained in:
15
src/bin.rs
15
src/bin.rs
@@ -30,16 +30,27 @@ fn main() {
|
||||
.iter()
|
||||
.map(|(p, contents)| template_from_file(p, contents))
|
||||
.collect();
|
||||
let mut dust_context = DustRenderer::new();
|
||||
let mut dust_renderer = DustRenderer::new();
|
||||
compiled_templates.iter().for_each(|template| {
|
||||
dust_context.load_source(template);
|
||||
dust_renderer.load_source(template);
|
||||
});
|
||||
let main_template_name = &compiled_templates
|
||||
.first()
|
||||
.expect("There should be more than 1 template")
|
||||
.name;
|
||||
println!(
|
||||
"{}",
|
||||
dust_renderer
|
||||
.render(main_template_name, context)
|
||||
.expect("Failed to render")
|
||||
);
|
||||
}
|
||||
|
||||
fn template_from_file<'a>(file_path: &str, file_contents: &'a str) -> CompiledTemplate<'a> {
|
||||
let path: &Path = Path::new(file_path);
|
||||
let name = path.file_stem().unwrap();
|
||||
compile_template(file_contents, name.to_string_lossy().to_string())
|
||||
.expect("Failed to compile template")
|
||||
}
|
||||
|
||||
fn read_context_from_stdin() -> serde_json::map::Map<String, serde_json::Value> {
|
||||
|
||||
Reference in New Issue
Block a user