aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askama_parser/src/node.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs
index 93fca73..dc05f48 100644
--- a/askama_parser/src/node.rs
+++ b/askama_parser/src/node.rs
@@ -299,7 +299,15 @@ impl<'a> Cond<'a> {
let mut p = tuple((
|i| s.tag_block_start(i),
opt(Whitespace::parse),
- ws(keyword("else")),
+ ws(alt((keyword("else"), |i| {
+ let _ = keyword("elif")(i)?;
+ Err(nom::Err::Failure(ErrorContext {
+ input: i,
+ message: Some(Cow::Borrowed(
+ "unknown `elif` keyword; did you mean `else if`?",
+ )),
+ }))
+ }))),
cut(tuple((
opt(|i| CondTest::parse(i, s)),
opt(Whitespace::parse),