aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src
diff options
context:
space:
mode:
authorLibravatar René Kijewski <rene.kijewski@fu-berlin.de>2023-01-30 13:09:49 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-01-30 14:19:46 +0100
commit63b98ec7d379768d771966c6aa44de20862e0994 (patch)
tree894aa4967a46890adf7af4ea0c06eac42afa0c46 /askama_derive/src
parent071106d94254d67388de64f0a7727732b345f413 (diff)
downloadaskama-63b98ec7d379768d771966c6aa44de20862e0994.tar.gz
askama-63b98ec7d379768d771966c6aa44de20862e0994.tar.bz2
askama-63b98ec7d379768d771966c6aa44de20862e0994.zip
Extends expects a string and nothing else
Diffstat (limited to 'askama_derive/src')
-rw-r--r--askama_derive/src/generator.rs2
-rw-r--r--askama_derive/src/heritage.rs4
-rw-r--r--askama_derive/src/parser.rs4
3 files changed, 5 insertions, 5 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 5770bd5..173fab1 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -200,7 +200,7 @@ fn find_used_templates(
while let Some((path, source)) = check.pop() {
for n in parse(&source, input.syntax)? {
match n {
- Node::Extends(Expr::StrLit(extends)) => {
+ Node::Extends(extends) => {
let extends = input.config.find_template(extends, Some(&path))?;
let dependency_path = (path.clone(), extends.clone());
if dependency_graph.contains(&dependency_path) {
diff --git a/askama_derive/src/heritage.rs b/askama_derive/src/heritage.rs
index 010f723..ec1997e 100644
--- a/askama_derive/src/heritage.rs
+++ b/askama_derive/src/heritage.rs
@@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::path::{Path, PathBuf};
use crate::config::Config;
-use crate::parser::{Expr, Loop, Macro, Node};
+use crate::parser::{Loop, Macro, Node};
use crate::CompileError;
pub(crate) struct Heritage<'a> {
@@ -58,7 +58,7 @@ impl Context<'_> {
while let Some(nodes) = nested.pop() {
for n in nodes {
match n {
- Node::Extends(Expr::StrLit(extends_path)) if top => match extends {
+ Node::Extends(extends_path) if top => match extends {
Some(_) => return Err("multiple extend blocks found".into()),
None => {
extends = Some(config.find_template(extends_path, Some(path))?);
diff --git a/askama_derive/src/parser.rs b/askama_derive/src/parser.rs
index bcf9c58..5045731 100644
--- a/askama_derive/src/parser.rs
+++ b/askama_derive/src/parser.rs
@@ -24,7 +24,7 @@ pub(crate) enum Node<'a> {
Cond(Vec<Cond<'a>>, Ws),
Match(Ws, Expr<'a>, Vec<When<'a>>, Ws),
Loop(Loop<'a>),
- Extends(Expr<'a>),
+ Extends(&'a str),
BlockDef(Ws, &'a str, Vec<Node<'a>>, Ws),
Include(Ws, &'a str),
Import(Ws, &'a str, &'a str),
@@ -985,7 +985,7 @@ fn block_for<'a>(i: &'a str, s: &State<'_>) -> IResult<&'a str, Node<'a>> {
}
fn block_extends(i: &str) -> IResult<&str, Node<'_>> {
- let (i, (_, name)) = tuple((ws(keyword("extends")), ws(expr_str_lit)))(i)?;
+ let (i, (_, name)) = tuple((ws(keyword("extends")), ws(str_lit)))(i)?;
Ok((i, Node::Extends(name)))
}