From 9e7fe8f2f9344d171800f98b556751d981ff9b17 Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Fri, 16 Jul 2021 16:14:30 +0200 Subject: Allow using "with" keyword in "let" statements Askama uses the syntax `{% when Variant with (parameters) %}` in `{% match %}` blocks. This change allows the optional use of the keyword "with" in "let" and "if let" statements, too. --- askama_shared/src/parser.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'askama_shared/src/parser.rs') diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs index 261887b..d2b2cd1 100644 --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -442,6 +442,7 @@ fn target(i: &[u8]) -> IResult<&[u8], Target<'_>> { // match structs let (i, path) = opt(path)(i)?; if let Some(path) = path { + let (i, _) = opt(ws(tag("with")))(i)?; let (i, is_unnamed_struct) = opt_opening_paren(i)?; if is_unnamed_struct { let (i, targets) = alt(( -- cgit