aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src
diff options
context:
space:
mode:
authorLibravatar René Kijewski <kijewski@library.vetmed.fu-berlin.de>2021-07-16 16:14:30 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2021-07-30 11:45:56 +0200
commit9e7fe8f2f9344d171800f98b556751d981ff9b17 (patch)
treeac858280756ddb44ca7ef168b10f4ac71b700927 /askama_shared/src
parent136e55c8cfab6e058e6a734cc8193706c95553e9 (diff)
downloadaskama-9e7fe8f2f9344d171800f98b556751d981ff9b17.tar.gz
askama-9e7fe8f2f9344d171800f98b556751d981ff9b17.tar.bz2
askama-9e7fe8f2f9344d171800f98b556751d981ff9b17.zip
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.
Diffstat (limited to '')
-rw-r--r--askama_shared/src/parser.rs1
1 files changed, 1 insertions, 0 deletions
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((