msangel
msangel

Reputation: 10357

'{' came as a complete surprise to me

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?

Upvotes: 3

Views: 1884

Answers (3)

Alex Miller
Alex Miller

Reputation: 70241

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.

Upvotes: 0

Peter
Peter

Reputation: 5884

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

Upvotes: 1

tmwanik
tmwanik

Reputation: 1661

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

Upvotes: 0

Related Questions