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

Ensure codemod mode ignores whitespace control. #983

Merged
merged 1 commit into from Oct 28, 2019

Commits on Oct 28, 2019

  1. Ensure codemod mode ignores whitespace control.

    `handlebars.parse` automatically applies whitespace control to the AST
    before it is returned. For example, parsing the following template
    ([feel free to review the AST on
    ASTExplorer](https://astexplorer.net/#/gist/f850c5457b808756107c0bc5ad226989/b0366df64be5c01b5f9eadd93e795b3b9d65d2c7)):
    
    ```hbs
     {{#foo}}
       {{~bar~}} {{baz~}}
     {{/foo}}
    ```
    
    Using `Handlebars.parse`, the AST returned would have truncated the following whitespace:
    
    * The whitespace prior to the `{{#foo}}`
    * The newline following `{{#foo}}`
    * The leading whitespace before `{{~bar~}}`
    * The whitespace between `{{~bar~}}` and `{{baz~}}`
    * The newline after `{{baz~}}`
    * The whitespace prior to the `{{/foo}}`
    
    A future version of `handlebars` (likely 4.5.0) will have a new method named
    `parseWithoutProcessing`. When we update to that version we can remove
    the custom workaround here.
    rwjblue committed Oct 28, 2019
    Configuration menu
    Copy the full SHA
    f1b9619 View commit details
    Browse the repository at this point in the history