freemarker-notifications mailing list archives

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

    [ https://issues.apache.org/jira/browse/FREEMARKER-37?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15626370#comment-15626370
] 

Daniel Dekany edited comment on FREEMARKER-37 at 11/1/16 7:08 PM:
------------------------------------------------------------------

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.


was (Author: ddekany):
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: https://issues.apache.org/jira/browse/FREEMARKER-37
>             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
(v6.3.4#6332)

Mime
View raw message