machty / emblem.js

Emblem.js - Ember-friendly, indented syntax alternative for Handlebars.js
http://emblemjs.com
MIT License
1.04k stars 81 forks source link

Comments and else blocks #261

Closed thec0keman closed 8 years ago

thec0keman commented 8 years ago

The following:

/ Hi
= if foo 
  p Hi
/ Bye
= else if bar
  p bye

generates

{{#if foo}}<p>Hi</p>{{/if}}{{#else if bar}}<p>bye</p>{{/else}}

The simple fix is to move the comments inside of the if blocks:

= if foo 
  / Hi
  p Hi
= else if bar
  / Bye
  p bye

generates

{{#if foo}}<p>Hi</p>{{else if bar}}<p>bye</p>{{/if}}

I suspect lines with comments just aren't being ignored correctly when determining the nested else blocks.

thec0keman commented 8 years ago

Fixed #267