Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.0-alpha-1, 2.6.0-alpha-3, 2.5.0-rc-1, 2.4.15
-
None
-
jdk1.6u16, windows xp
-
Patch
Description
If a backslash exists in the template, SimpleTemplateEngine can not escape it, as a result, an exception throwed.
Enjoy the patch
import groovy.text.* String templateContent = new File(/D:\_APPS\groovy_apps\TemplateEnginTest\echo.xml/).text def engineForBuildXml = new SimpleTemplateEngine() def templateForBuildXml = engineForBuildXml.createTemplate(templateContent) String buildXmlContent = templateForBuildXml.make([names:['a', 'b', 'c']]).toString() println buildXmlContent
<?xml version="1.0" encoding="GB2312"?> <project name="projBuild" default="projBuild" basedir="."> <property name="drive" value="d:\" /> <target name="projBuild"> <%for (int i = 0; i < names.size(); i++) {%> <exec dir="$${drive}" executable="echo"> <arg line="${names[i]}"/> </exec> <%}%> </target> </project>
Attachments
Attachments
Issue Links
- links to