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 Handlebars inline partials #1756

Closed
andycnguyen opened this issue Feb 7, 2020 · 1 comment · Fixed by #1782
Closed

Incorrect indentation of Handlebars inline partials #1756

andycnguyen opened this issue Feb 7, 2020 · 1 comment · Fixed by #1782

Comments

@andycnguyen
Copy link

Input

The code looked like this before beautification:

{{#*inline "MyInlinePartial"}}
{{MyIdentifier}}
{{/inline}}

Expected Output

The code should have looked like this after beautification:

{{#*inline "MyInlinePartial"}}
    {{MyIdentifier}}
{{/inline}}

Actual Output

The code actually looked like this after beautification:

    {{#*inline "MyInlinePartial"}}
        {{MyIdentifier}}
        {{/inline}}

Steps to Reproduce

Settings

Example:

{
    "indent_handlebars": true
}
@bitwiseman
Copy link
Member

Inline Partials: https://handlebarsjs.com/guide/partials.html#inline-partials

This pattern recognizer is looking for {{# or {{^ which is fine...

https://github.com/beautify-web/js-beautify/blob/ae3e9e6b1c47487c72f92951333b2944dd5160b0/js/src/html/beautifier.js#L608-L609

but this this line thinks the name of the tag is *inline when it is actually inline.
https://github.com/beautify-web/js-beautify/blob/ae3e9e6b1c47487c72f92951333b2944dd5160b0/js/src/html/beautifier.js#L618

Should someone have time to fix this, they'll need to add a check for * and then add tests.

bitwiseman added a commit to bitwiseman/js-beautify that referenced this issue Apr 5, 2020
bitwiseman added a commit to bitwiseman/js-beautify that referenced this issue Apr 5, 2020
@bitwiseman bitwiseman modified the milestones: v1.11.x, v1.11.0 Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants