From 38e161ae3dbbe4673464364202f8a962e00e5c23 Mon Sep 17 00:00:00 2001 From: KitsuneCafe <10284516+kitsunecafe@users.noreply.github.com> Date: Mon, 5 Feb 2024 15:48:17 -0500 Subject: [PATCH] handle nested includes/extends --- src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a5f1b60..78418c8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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(())