Uploaded image for project: 'Apache Freemarker'
  1. Apache Freemarker
  2. FREEMARKER-79

Introduce <#continue> to skip an item within <#list>

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.3.26-incubating
    • None
    • engine
    • None

    Description

      Freemarker has <#break> but no <#continue> to skip items in a <#list>.

      It has been considered few times, but seems it's not here in Apache Jira, so I'm adding it.

      Copying the reasoning from old FM feature request https://sourceforge.net/p/freemarker/feature-requests/79/

      In Freemarker 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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pekarna Ondra Žižka
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: