3

I want to use org.stringtemplate.v4.* as template engine for rendering html pages. However I cant find how to escape open brackets in my file. Templator thinks that it is some expression, while it is just javascript code.

I tried \{ but this not help - i stil got

504:15: invalid character '\'
504:16: '{' came as a complete surprise to me

How to escape this? Or what analogs of stringtemplate exist, that can correctly handle html page as input?

Xavi López
  • 27,550
  • 11
  • 97
  • 161
msangel
  • 9,895
  • 3
  • 50
  • 69

3 Answers3

1

When I got this error was because I forgot a end sign ($) for a attribute. It should be like this $attribute.name$

Reference: http://www.antlr.org/wiki/display/ST/Expressions#Expressions-AttributeReferences

Peter
  • 5,556
  • 3
  • 23
  • 38
0

Since java is tagged, i would guess you have to also escape \ since it's a special character in java to may be \\{

tmwanik
  • 1,643
  • 14
  • 20
0

I ran into this when I had an unescaped $ inside some content inside an XML file I was using as a template. Fixed it by using \$ instead.

Alex Miller
  • 69,183
  • 25
  • 122
  • 167