aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src
diff options
context:
space:
mode:
authorLibravatar PizzasBear <43722034+PizzasBear@users.noreply.github.com>2023-11-22 15:56:14 +0200
committerLibravatar GitHub <noreply@github.com>2023-11-22 14:56:14 +0100
commit48c6cd327d3c1df4218898be509250efcc56597c (patch)
tree6db2748a99e036960a0421070c222af096f040b7 /askama_derive/src
parentea7267dfc2914cdc340bae1a823c0660daef19e6 (diff)
downloadaskama-48c6cd327d3c1df4218898be509250efcc56597c.tar.gz
askama-48c6cd327d3c1df4218898be509250efcc56597c.tar.bz2
askama-48c6cd327d3c1df4218898be509250efcc56597c.zip
Enhance match to include multiple targets (#911)
Signed-off-by: max <gmx.sht@gmail.com>
Diffstat (limited to 'askama_derive/src')
-rw-r--r--askama_derive/src/generator.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 8f0b7b3..c6c5d10 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -1579,6 +1579,16 @@ impl<'a> Generator<'a> {
}
buf.write(name);
}
+ Target::OrChain(targets) => match targets.first() {
+ None => buf.write("_"),
+ Some(first_target) => {
+ self.visit_target(buf, initialized, first_level, first_target);
+ for target in &targets[1..] {
+ buf.write(" | ");
+ self.visit_target(buf, initialized, first_level, target);
+ }
+ }
+ },
Target::Tuple(path, targets) => {
buf.write(&path.join("::"));
buf.write("(");