Add "continue" directive inside list
Generates text that depends on changing data (like dynamic HTML).
Brought to you by:
revusky
Hi there,
as exposed in [1] you can use break directive to exit from a list loop: actually I would need a "continue" directive to go to the next item if some condition is verified.
EG:
<#assign seq = ["winter", "spring", "summer", "autumn"]>
<#list seq as x>
<#if x = "spring"><#continue></#if>
${x}
</#list>
This will simply not print spring skipping directly to next item.
What do you think about it?
Thanks
Bye
Piero
[1]http://freemarker.sourceforge.net/docs/ref_directive_list.html
I have no idea why do FTL has #break but no #continue... I assume it should be added. (One could say that just put the rest of the nested content into <#if x != "spring">, but for more complex cases that approach obviously won't work.) Only I really can't tell any deadlines for that...
It's now 2017 and still no <#continue> despite it being in so many other languages. Now I have to make my code ugly with another <#if> layer to achieve that otherwise simple effect. Ridonkulous.
Things like that happen when no contributor misses a feature in his work... it fellt through the cracks. I will try to get it into 2.3.27.
Last edit: Dániel Dékány 2017-06-04
Implemented in Git head (released in 2.3.27).
Last edit: Dániel Dékány 2017-09-17