Skip to content

Whitespace management #1072

@pizzafroide

Description

@pizzafroide

New line characters after the start tag of a section, or after a comment, are discarded. I may be wrong but I think they shouldn't be.

Here is the example from the doc with a little modification (the ~ at the of the {{#each}} expression was removed):

{{#each nav}}
  <a href="{{url}}">
    {{~#if test}}
      {{~title}}
    {{~^~}}
      Empty
    {{~/if~}}
  </a>
{{~/each}}

with:

{
  nav: [
    {url: 'foo', test: true, title: 'bar'},
    {url: 'bar'}
  ]
}

results in:

  <a href="foo">bar</a>  <a href="bar">Empty</a>

Instead of:

  <a href="foo">bar</a>  
  <a href="bar">Empty</a>

Edit: When rereading the documentation, I see that:

This expands the default behavior of stripping lines that are "standalone" helpers (only a block helper, comment, or partial and whitespace).".

So I guess this post is most likely an enhancement request: would it be possible to disable this default behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions