duster/js/test_cases/internal_whitespace
Tom Alexander 31029bf50b
Add a test for whitespace inside the template.
This is similar to the surrounding whitespace test but for whitespace inside of a tag as opposed to before/after the first element of the template.
2020-05-02 19:30:23 -04:00
..
input1.json Add a test for whitespace inside the template. 2020-05-02 19:30:23 -04:00
main.dust Add a test for whitespace inside the template. 2020-05-02 19:30:23 -04:00
README.md Add a test for whitespace inside the template. 2020-05-02 19:30:23 -04:00

Through experimentation I have determined that DustJS:

  • Ignores newlines entirely (probably why there is a special character for newlines)
  • Ignores spaces on empty lines
  • Ignore tabs on empty lines
  • Honors interior tabs
  • Honors interior spaces
  • Honors trailing spaces on opening, body, and closing tags
  • Honors trailing spaces on tagless lines with content
  • Honors trailing tabs on opening, body, and closing tags
  • Honors trailing tabs on tagless lines with content
  • Ignores leading spaces on opening, body, and closing tags
  • Ignores leading spaces on tagless lines with content
  • Ignores leading tabs on opening, body, and closing tags
  • Ignores leading tabs on tagless lines with content

Definitions

Interior: Surounnded by tags on the same line:

{foo}this is interior{/foo}

Trailing: On a line with a tag but no tag following it on that line:

{stuff}
{name}this is trailing
{other stuff}

Leading: On a line with a tag but no tag preceding it on that line:

{stuff}
this is leading{name}
{other stuff}