From fc0863f40b64ff927a3aa1261b3d8d30afe68d85 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 25 Jun 2018 12:46:00 +0200 Subject: Add support for 'loop.first' variable --- askama_derive/src/generator.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'askama_derive') 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"); } -- cgit