From 1622df7aeecb71fca2da630330513b26cefef16b Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Fri, 16 Jul 2021 16:23:31 +0200 Subject: Allow omitting "with" keyword in match blocks Askama uses the syntax `{% when Variant with (parameters) %}` in `{% match %}` blocks. This is done because Askama does not implement the whole pattern matching of Rust's `match` statements. This PR wants to bring Askama a step closer Rust's matching, so the "with" keyword should not be needed anymore. --- askama_shared/src/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'askama_shared') diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs index d2b2cd1..29b325d 100644 --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -550,7 +550,7 @@ fn parameters(i: &[u8]) -> IResult<&[u8], Vec<&str>> { fn with_parameters(i: &[u8]) -> IResult<&[u8], MatchParameters<'_>> { let (i, (_, value)) = tuple(( - tag("with"), + opt(tag("with")), alt((match_simple_parameters, match_named_parameters)), ))(i)?; Ok((i, value)) -- cgit