freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Dekany (JIRA)" <>
Subject [jira] [Commented] (FREEMARKER-37) ability to skip iteration in a list
Date Tue, 01 Nov 2016 19:08:58 GMT


Daniel Dekany commented on FREEMARKER-37:

The problem is deeper than that, because {{#list}} isn't just an odd name for {{for}}. {{#list}}
deals with things like item separators, item index, etc. Thus if you skip items like that
(with a big {{#if}} or a {{#continue}]), you can't use those features. So the real solution
would be list filtering... which is a more difficult problem than {{#continue}}. So, yeah,
skipping is badly needed, but {{#continue}} is not the good solution for it.

> ability to skip iteration in a list
> -----------------------------------
>                 Key: FREEMARKER-37
>                 URL:
>             Project: Apache Freemarker
>          Issue Type: Improvement
>            Reporter: Ivan Levchenko
> Sorely missing ability to skip through an iteration of a list and continue on with the
rest of the list. would like to write clean code like this:
> <#list collection as element>
>         <#if element.attr1 == "some_value"> 
>                 <#continue />  <#-- skip over this item and run next item in
loop -->
>         </#if>
>     do stuff here
> </#list>
> Thanks!

This message was sent by Atlassian JIRA

View raw message