beautifier/js-beautify

Handlebars {{#tr}} helper is indented as if it were a <tr> tag

Open

#2045 aperta il 13 apr 2022

Vedi su GitHub
 (6 commenti) (0 reazioni) (0 assegnatari)JavaScript (1460 fork)batch import
good first issuelanguage: htmltype: bug

Metriche repository

Star
 (8342 star)
Metriche merge PR
 (Merge medio 51g 1h) (16 PR mergiate in 30 g)

Descrizione

Description

Zulip defines a custom Handlebars helper {{#tr}} for translation, but when it happens to be used inside a table cell, js-beautify seemingly confuses it with a <tr> (table row) tag and indents it at the wrong level.

Input

The code looked like this before beautification:

<table>
    <tr>
        <td>
            {{#tr}}translated{{/tr}}
        </td>
    </tr>
</table>

Expected Output

The code should have looked like this after beautification:

<table>
    <tr>
        <td>
            {{#tr}}translated{{/tr}}
        </td>
    </tr>
</table>

Actual Output

The code actually looked like this after beautification:

<table>
    <tr>
        <td>
    {{#tr}}translated{{/tr}}
    </td>
    </tr>
</table>

Steps to Reproduce

html-beautify -H test.hbs

Environment

OS: Linux

Settings

None

Guida contributor