handlebars-lang / handlebars.js

Minimal templating on steroids.
http://handlebarsjs.com
MIT License
17.81k stars 2.04k forks source link

Extra } not part of template causing errors #2028

Closed jvassev closed 4 months ago

jvassev commented 4 months ago

Have a look at this example: https://handlebarsjs.com/playground.html#format=1&currentExample=%7B%22template%22%3A%22export%20PATH%3D%5C%22%24%7BPATH%3A-%7B%7Bfirstname%7D%7D%7D%5C%22%5Cn%22%2C%22partials%22%3A%5B%5D%2C%22input%22%3A%22%7B%5Cn%20%20firstname%3A%20%5C%22original%5C%22%2C%5Cn%20%20close%3A%20%5C%22%7D%5C%22%5Cn%7D%5Cn%22%2C%22output%22%3A%22export%20PATH%3D%5C%22%24%7BPATH%3A-original%5C%22%5Cn%22%2C%22preparationScript%22%3A%22%22%2C%22handlebarsVersion%22%3A%224.7.8%22%7D

A template like {{name}}} parses find but when rendering it fails. I think this should render as name} as the final curly is not part of an expression.

As a workaround I use a var close='}' to put a closing curly at the end

jaylinski commented 4 months ago

I know this is annoying, but the parser throwing an exception works as intended.

See #2013 for another possible workaround.