handlebars.java icon indicating copy to clipboard operation
handlebars.java copied to clipboard

If-Else block allow multiple else blocks

Open sshailabh opened this issue 1 year ago • 1 comments

In conditional block, multiple else are allowed in the template. This should throw an error on compilation. Sample example:

{{#if author}}
 If block
{{else}}
Else 1
{{else}}
Else 2
{{/if}}

Handlebar.js is able to catch multiple else statements. Below is the error generated there. image

sshailabh avatar Apr 23 '24 08:04 sshailabh

Fixing the issue with this pr: https://github.com/jknack/handlebars.java/pull/1154 Here, changed the parser grammar to disallow multiple else statements. Please check the description for more details.

sshailabh avatar Dec 08 '24 21:12 sshailabh