handle nested includes/extends
This commit is contained in:
parent
06c9e87041
commit
38e161ae3d
|
@ -1,4 +1,4 @@
|
||||||
use std::path::PathBuf;
|
use std::{path::PathBuf, io::BufReader, fs::{File, read, self}};
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
@ -55,6 +55,10 @@ impl<'a> TeraParser<'a> {
|
||||||
|
|
||||||
self.tera
|
self.tera
|
||||||
.add_template_file(&path.canonicalize().unwrap(), Some(layout_path))?;
|
.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(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue