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

Fails to recognize Handlebars block with whitespace control, e.g. {{~#if true ~}} #1988

Closed
andersk opened this issue Feb 26, 2022 · 1 comment

Comments

@andersk
Copy link

andersk commented Feb 26, 2022

Description

Handlebars supports whitespace control by putting ~ on one or both sides of any double-brace-enclosed statement. But js-beautify fails to recognize a statement with whitespace control, resulting in incorrect indentation.

Input

The code looked like this before beautification:

{{#if true}}<div><div>
{{~#if true ~}}<p>true</p>{{/if}}
</div></div>{{/if}}

Expected Output

The code should have looked like this after beautification:

{{#if true}}
    <div>
        <div>
            {{~#if true ~}}
                <p>true</p>
            {{/if}}
        </div>
    </div>
{{/if}}

Actual Output

The code actually looked like this after beautification:

{{#if true}}
    <div>
        <div>
            {{~#if true ~}}
            <p>true</p>
{{/if}}
</div>
</div>{{/if}}

Steps to Reproduce

html-beautify -H test.hbs

Environment

OS: Linux

Settings

None

@zalsaedy
Copy link
Contributor

Hello! I saw this issue and would like to work on it. Are there any steps I need to take before doing so, besides what was stated in CONTRIBUTING.md?

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

3 participants