@@ -62,7 +62,8 @@ public Object apply(final Object context, final Options options)
6262 while (loop .hasNext ()) {
6363 Object it = loop .next ();
6464 Context itCtx = Context .newContext (parent , it );
65- itCtx .combine ("@index" , index )
65+ itCtx .combine ("@key" , index )
66+ .combine ("@index" , index )
6667 .combine ("@first" , index == base ? "first" : "" )
6768 .combine ("@last" , !loop .hasNext () ? "last" : "" )
6869 .combine ("@odd" , even ? "" : "odd" )
@@ -79,6 +80,7 @@ public Object apply(final Object context, final Options options)
7980 }
8081 return buffer ;
8182 } else if (context != null ) {
83+ int index = 0 ;
8284 Iterator loop = options .propertySet (context ).iterator ();
8385 Context parent = options .context ;
8486 boolean first = true ;
@@ -90,11 +92,13 @@ public Object apply(final Object context, final Options options)
9092 Object value = entry .getValue ();
9193 Context itCtx = Context .newBuilder (parent , value )
9294 .combine ("@key" , key )
95+ .combine ("@index" , index )
9396 .combine ("@first" , first ? "first" : "" )
9497 .combine ("@last" , !loop .hasNext () ? "last" : "" )
9598 .build ();
9699 buffer .append (options .apply (fn , itCtx , Arrays .asList (value , key )));
97100 first = false ;
101+ index ++;
98102 }
99103 // empty?
100104 if (first ) {
0 commit comments