handle nested includes/extends

This commit is contained in:
KitsuneCafe 2024-02-05 15:48:17 -05:00
parent 06c9e87041
commit 38e161ae3d

View file

@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::{path::PathBuf, io::BufReader, fs::{File, read, self}};
use once_cell::sync::Lazy;
use regex::Regex;
@ -55,6 +55,10 @@ impl<'a> TeraParser<'a> {
self.tera
.add_template_file(&path.canonicalize().unwrap(), Some(layout_path))?;
let next_template = fs::read(&path)?;
let path_str = path.to_string_lossy().to_string();
self.load_template(path_str.as_str(), &next_template)?;
}
Ok(())