From 0711e3667b1e06e891b1b6972035d0330c5ae4c2 Mon Sep 17 00:00:00 2001 From: bott Date: Fri, 14 Sep 2018 02:14:58 +0200 Subject: Fix operator preference at loop.index --- askama_derive/src/generator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'askama_derive/src/generator.rs') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index d0ac030..b6b5146 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -748,7 +748,7 @@ impl<'a> Generator<'a> { if let Expr::Var(name) = *obj { if name == "loop" { if attr == "index" { - buf.write("_loop_index + 1"); + buf.write("(_loop_index + 1)"); return DisplayWrap::Unwrapped; } else if attr == "index0" { buf.write("_loop_index"); -- cgit