You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christopher Chase (Jira)" <ji...@apache.org> on 2020/04/15 01:42:00 UTC

[jira] [Updated] (GROOVY-9507) JSP style loop in StreamingTemplateEngine template results in TemplateParseException

     [ https://issues.apache.org/jira/browse/GROOVY-9507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Chase updated GROOVY-9507:
--------------------------------------
    Description: 
 

The example below works as expected when run in Groovy 2.5.8, yet it fails when run in Groovy 3.0.3

 

 
{code:java}
TemplateEngine engine = new StreamingTemplateEngine()

Template template = engine.createTemplate('''
<ul>
    <% items.each { %>
    <li>${it}</li>
    <% } %>
</ul>
''')

println template.make([items : [1,2,3,4]])
{code}
 

Expected output (and the output 2.5.8 yields):

 
{noformat}
<ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <li>4</li>
</ul>{noformat}
 

Exception 3.0.3 gives:

 
{noformat}
Exception in thread "main" groovy.text.TemplateParseException: Template parse error 'Unexpected input: '{'; Expecting RBRACE ' at line 3, column 27
         2:         <ul>
     --> 3:             <% items.each { %>
         4:             <li>${it}</li>{noformat}
 

 

  was:
 

The example below works as expected when run in Groovy 2.5.8, yet it fails when run in Groovy 3.0.3

 

 
{code:java}
TemplateEngine engine = new StreamingTemplateEngine()

Template template = engine.createTemplate('''
<ul>
    <% items.each { %>
    <li>${it}</li>
    <% } %>
</ul>
''')

println template.make([items : [1,2,3,4]])
{code}
 

Expected output (and the output 2.5.8 yields):

 
{noformat}
<ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <li>4</li>
</ul>{noformat}
 

Exception:

 
{noformat}
Exception in thread "main" groovy.text.TemplateParseException: Template parse error 'Unexpected input: '{'; Expecting RBRACE ' at line 3, column 27
         2:         <ul>
     --> 3:             <% items.each { %>
         4:             <li>${it}</li>{noformat}
 

 


> JSP style loop in StreamingTemplateEngine template results in TemplateParseException
> ------------------------------------------------------------------------------------
>
>                 Key: GROOVY-9507
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9507
>             Project: Groovy
>          Issue Type: Bug
>          Components: Templating
>    Affects Versions: 3.0.3
>            Reporter: Christopher Chase
>            Priority: Major
>
>  
> The example below works as expected when run in Groovy 2.5.8, yet it fails when run in Groovy 3.0.3
>  
>  
> {code:java}
> TemplateEngine engine = new StreamingTemplateEngine()
> Template template = engine.createTemplate('''
> <ul>
>     <% items.each { %>
>     <li>${it}</li>
>     <% } %>
> </ul>
> ''')
> println template.make([items : [1,2,3,4]])
> {code}
>  
> Expected output (and the output 2.5.8 yields):
>  
> {noformat}
> <ul>
>   <li>1</li>
>   <li>2</li>
>   <li>3</li>
>   <li>4</li>
> </ul>{noformat}
>  
> Exception 3.0.3 gives:
>  
> {noformat}
> Exception in thread "main" groovy.text.TemplateParseException: Template parse error 'Unexpected input: '{'; Expecting RBRACE ' at line 3, column 27
>          2:         <ul>
>      --> 3:             <% items.each { %>
>          4:             <li>${it}</li>{noformat}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)