beautifier / js-beautify

Beautifier for javascript
https://beautifier.io
MIT License
8.55k stars 1.37k forks source link

Spaces added to handlebars with '=' #1460

Closed MacKLess closed 6 years ago

MacKLess commented 6 years ago

Description

Based on Issue #660 in which the expected output should have looked like:

{{em-input label="Some Labe" property="amt" type="text" placeholder=""}}
{{em-input label="Type*" property="type" type="text" placeholder="(LTD)"}}
{{em-input label="Place*" property="place" type="text" placeholder=""}}

Obviously, the full support is not the point, but it shouldn't be adding the spaces.

Input

The code looked like this before beautification:

{{em-input label="Some Labe" property="amt" type="text" placeholder=""}} {{em-input label="Type*" property="type" type="text" placeholder="(LTD)"}} {{em-input label="Place*" property="place" type="text" placeholder=""}}

Current Output

The code actually looked like this after beautification:

{{em-input label= "Some Labe" property= "amt" type= "text" placeholder= ""}} {{em-input label= "Type*" property= "type" type= "text" placeholder= "(LTD)"}} {{em-input label= "Place*" property= "place" type= "text" placeholder= ""}}

Expected Output

The code should have looked like this after beautification:

/*This should be unchanged.*/
{{em-input label="Some Labe" property="amt" type="text" placeholder=""}} {{em-input label="Type*" property="type" type="text" placeholder="(LTD)"}} {{em-input label="Place*" property="place" type="text" placeholder=""}}

Environment

Browser User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Language Selected: HTML

Settings

Example:

{
  "indent_size": "4",
  "indent_char": " ",
  "max_preserve_newlines": "5",
  "preserve_newlines": true,
  "keep_array_indentation": false,
  "break_chained_methods": false,
  "indent_scripts": "normal",
  "brace_style": "collapse",
  "space_before_conditional": true,
  "unescape_strings": false,
  "jslint_happy": false,
  "end_with_newline": false,
  "wrap_line_length": "0",
  "indent_inner_html": false,
  "comma_first": false,
  "e4x": false,
  "indent_handlebars": true
}
bitwiseman commented 6 years ago

This occurs on the master branch currently. It doesn't repro in rc2, thankfully. Great early catch.