mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-28 13:30:59 +00:00

`target()` as used in parsing "let" and "if let" implements parsing nested tuples and structs. But it does not implement parsing literals. The functions `match_variant()` and `with_parameters()` as used in parsing "when" blocks do not implement parsing nested structs, but it implements parsing literals. This PR combines `match_variant()` and `with_parameters()` into `target()`, so that all `{%when%}` support nested structs, too.
11 lines
233 B
HTML
11 lines
233 B
HTML
{%- match foo -%}
|
|
{%- when None -%}
|
|
nothing
|
|
{%- when Some(Err(err)) -%}
|
|
err={{err}}
|
|
{%- when Some(Ok(None)) -%}
|
|
num=absent
|
|
{%- when Some(Ok(Some(num))) -%}
|
|
num={{num}}
|
|
{%- endmatch -%}
|