mainmatter / emblem-migrator

Migrate Emblem.js to pretty Handlebars files
MIT License
9 stars 1 forks source link

Nested if / else bug #2

Closed dcyriller closed 5 years ago

dcyriller commented 5 years ago

Description

Running the script, I ran into a bug with nested if / else.

Reproduction

Before:

if inGoodMood
  if inVeryGoodMood
    h1 hiii
  else
    h1 hi
else
  if inVeryBadMood
    span :unamused:
h1 bye

After:

{{#if inGoodMood}}
  {{#if inVeryGoodMood}}
    <h1>
      hiii
    </h1>
  {{else}}
    <h1>
      hi
    </h1>
  {{/if}}
{{else if inVeryBadMood}}
  <span>
    :unamused:
  </span>
<h1>
  bye
</h1>
{{/if}}

(see https://github.com/dcyriller/__emblem-to-hbs-nested-if)

dcyriller commented 5 years ago

I've opened a PR in prettier to fix the issue: https://github.com/prettier/prettier/pull/6080