From 1521a08a20b6631b54d4ecbbbfcb4260e393bc97 Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Tue, 1 Aug 2023 04:22:52 +0200 Subject: parser: add type for `Node::Extends` --- askama_derive/src/generator.rs | 2 +- askama_derive/src/heritage.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'askama_derive/src') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 626c7d2..f33829d 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -214,7 +214,7 @@ fn find_used_templates( for n in parsed.nodes() { match n { Node::Extends(extends) => { - let extends = input.config.find_template(extends, Some(&path))?; + let extends = input.config.find_template(extends.path, Some(&path))?; let dependency_path = (path.clone(), extends.clone()); if dependency_graph.contains(&dependency_path) { return Err(format!( diff --git a/askama_derive/src/heritage.rs b/askama_derive/src/heritage.rs index 1122e39..f09b83e 100644 --- a/askama_derive/src/heritage.rs +++ b/askama_derive/src/heritage.rs @@ -58,10 +58,10 @@ impl Context<'_> { while let Some(nodes) = nested.pop() { for n in nodes { match n { - Node::Extends(extends_path) if top => match extends { + Node::Extends(e) if top => match extends { Some(_) => return Err("multiple extend blocks found".into()), None => { - extends = Some(config.find_template(extends_path, Some(path))?); + extends = Some(config.find_template(e.path, Some(path))?); } }, Node::Macro(m) if top => { -- cgit