Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect indentation of ^ inverted section tags in Handlebars/Mustache code #1623

Closed
e2tha-e opened this issue Jan 29, 2019 · 1 comment
Closed

Comments

@e2tha-e
Copy link
Contributor

e2tha-e commented Jan 29, 2019

Fix indentation of ^ inverted section tags in Handlebars/Mustache code

Handlebars allows for ^ tags, like its precursor Mustache. They effectively do the same as the Handlebars #unless helper.

https://handlebarsjs.com/reference.html
https://mustache.github.io/mustache.5.html#Inverted-Sections

Input

The code looked like this before beautification:

{{#unless foo}}
{{bar}}
{{/unless}}
{{^foo}}
{{bar}}
{{/foo}}

Expected Output

The code should have looked like this after beautification:

{{#unless foo}}
  {{bar}}
{{/unless}}
{{^foo}}
  {{bar}}
{{/foo}}

Actual Output

The code actually looked like this after beautification:

{{#unless foo}} // The #unless block is indented correctly.
  {{bar}}
{{/unless}}
{{^foo}}
  {{bar}}
  {{/foo}} // Incorrect indentation that cascades to following lines.

Steps to Reproduce

options.indent_handlebars = true;

Environment

OS: any

@bitwiseman bitwiseman added this to the v1.9.x milestone Jan 30, 2019
@bitwiseman bitwiseman changed the title Fix indentation of ^ inverted section tags in Handlebars/Mustache code Incorrect indentation of ^ inverted section tags in Handlebars/Mustache code Jan 30, 2019
@bitwiseman
Copy link
Member

Published for 1.9.0-beta5. Fix is live on beautifier.io. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants