BUG: forloop.index Disrupted By Nested forloop

  • Liquid
  • New
  • Bugs
 0  Votes for this feature
If there is a forloop nested within another forloop, the use of is blocked anywhere preceding the nested forloop.

eg; In BC the following code and output seems correct:

{% for i in (1..4) %} *{{forloop.index}}*
{% for x in (1..2) %} ^{{forloop.index}}^
{% endfor %} #{{forloop.index}}#
{% endfor %}


OUTPUT:
*1*
^1^
^2^
#1#

*2*
^1^
^2^
#2#
*3*
^1^
^2^
#3#
*4*
^1^
^2^
#4#


But, in Treepl the same liquid forloop renders as:

*1*
^1^
^2^
##
**
^1^
^2^
##
**
^1^
^2^
##
**
^1^
^2^
##


After the nested forloop executes, the top level indexes are no longer rendered.

Forum post