snowindy/scriptlet4docx

Scriptlets don't allow using '>', '<', '"'

Closed this issue · 1 comments

My template has only one section now. So I'll just copy-paste the content here

<% if(L_TERM < 20) { %>

Show L_TERM less than 20 data

<% } else { %>

Show L_TERM greater than 20 data

<% } %>

and I'm getting the below error:

groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
GStringTemplateScript4.groovy: 5: expecting ')', found ';' @ line 5, column 69.
c92364810"""; if(L_TERM < 20) {;
^

1 error

    at groovy.text.GStringTemplateEngine$GStringTemplate.<init>(GStringTemplateEngine.java:190) 
    at groovy.text.GStringTemplateEngine.createTemplate(GStringTemplateEngine.java:105) 
    at groovy.text.TemplateEngine.createTemplate(TemplateEngine.java:38) 
    at org.scriptlet4docx.docx.DocxTemplater.processCleanedTemplate(DocxTemplater.java:156) 
    at org.scriptlet4docx.docx.DocxTemplater.process(DocxTemplater.java:253) 
    at org.scriptlet4docx.docx.DocxTemplater.processAndReturnInputStream(DocxTemplater.java:211) 
    at org.scriptlet4docx.docx.DocxTemplater.process(DocxTemplater.java:228) 

I can use equal sign perfectly fine, but < and > will get escaped.

Fixed on v0.7.6