Skip to content

The "spaceless" filter does not completely remove whitespace, may unnecessarily remove the following newline. #421

Description

@Hajime-Sasaki

Version: 3.1.4

Bug Description

The spaceless filter (also split) does not completely remove whitespace characters, may unnecessarily remove the newline character immediately following the block.

Steps To Reproduce

I couldn't save on https://fiddle.nette.org/latte by 500 error. Therefore, I wrote the code here;

Main template

Case 1.
{block |spaceless}
<ul>
    <li>Hello</li>
</ul>
{/block}
World.

---
Case 2.
<section>
{block |spaceless}
<ul>
    <li>Hello</li>
</ul>{/block}
World.
</section>

---
Case 3.
<section>
{block |spaceless}
  <ul>
    <li>Hello</li>
  </ul>{/block}
World.
</section>

Output

Case 1.
<section>
<ul> <li>Hello</li> </ul>World.
</section>

---
Case 2.
<section>
<ul> <li>Hello</li> </ul>
World.
</section>

---
Case 3.
<section>
<ul> <li>Hello</li> </ul>World.
</section>

Expected Behavior

I expected the following results for all;

<section>
<ul><li>Hello</li></ul>
World.
</section>

Remove internal whitespace, but do not remove the newline character immediately following the block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions