aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-06-25 12:46:00 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-06-25 12:46:00 +0200
commitfc0863f40b64ff927a3aa1261b3d8d30afe68d85 (patch)
tree3dde175bbd5bf8888d5c55fce30e448d4ac519df /askama_derive/src
parent1ea039498327066b2b5c2ffa8f6e48306f047284 (diff)
downloadaskama-fc0863f40b64ff927a3aa1261b3d8d30afe68d85.tar.gz
askama-fc0863f40b64ff927a3aa1261b3d8d30afe68d85.tar.bz2
askama-fc0863f40b64ff927a3aa1261b3d8d30afe68d85.zip
Add support for 'loop.first' variable
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 5ec2238..07c87bf 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -720,6 +720,9 @@ impl<'a> Generator<'a> {
return DisplayWrap::Unwrapped;
} else if attr == "index0" {
return DisplayWrap::Unwrapped;
+ } else if attr == "first" {
+ code.push_str(" == 0");
+ return DisplayWrap::Unwrapped;
} else {
panic!("unknown loop variable");
}