tildeio / htmlbars

A variant of Handlebars that emits DOM and allows you to write helpers that manipulate live DOM nodes
MIT License
1.6k stars 193 forks source link

Properly handle trailing whitespace controls. #458

Closed rwjblue closed 8 years ago

rwjblue commented 8 years ago

Previously, we were only handling the Handlebars default "eating" of a newline after a block statement but did not properly handle ~}} at the end of a block statement.

This updates to also calculate the column offsets (and adds tests).

Given the following:

{{#if foo~}}
  <div></div>
{{/if}}

Before these changes, the <div> would have a starting column of 0.

After these changes, the <div> has the correct starting column of 2.


Related to https://github.com/rwjblue/ember-template-lint/issues/34.