paularmstrong/swig — Issue #40: forloop.index not usable as Array index?
Author: flockonus
Created: 2012-01-24 03:49:45+00:00
State: open

Hi!

In a view I have this inside some template

{% for val in game.avg.rev_attr %}

{{forloop.key}}: [{{val}}] {{ avgRatingLabels[forloop.index] }}

{% endfor %}

And I load render variables as (kinda):

game.avg.rev_attr = { 'KEY': 'VALUE' }
avgRatingLabels = { 'KEY': 'LABEL' }
res.render( 'game/view', {
game: game,
avgRatingLabels: avgRatingLabels,
} )

It renders as: `
KEY: [VALUE]
`, but expected: `
KEY: [VALUE] LABEL
`

Found this bug while using it on Express 2.5.1, and node 0.4.7 (maybe also happens on >0.6), could not find any workaround this so far :(