Skip to content

Whitespace syntax #2099

@alubbe

Description

@alubbe

This follows up on the syntax discussion started in #2075
Specifically, how can we improve on these hacks: #905 (comment)

My suggestion is to turn single empty lines into a whitespace and do nothing for two empty lines. Specifically,

a(href="...") Link1

a(href="...") Link2

yields

<a href="...">Link1</a> <a href="...">Link2</a>      NOTE the space between the tags

but

a(href="...") Link1
a(href="...") Link2

and

a(href="...") Link1


a(href="...") Link2

yield

<a href="...">Link1</a><a href="...">Link2</a>      NOTE there is no space between the tags

This change would be breaking some backwards compatibility. I have been trying to assess how big of an issue it is and have been asking for code examples from others that would be negatively affected - so far, I have not found any problems with it.

In my own projects, I use empty lines to seperate between "blocks" of markup. This could be the space between block, mixin, include or extend (no breaking change here), but also between actual blocks of html markup. These are almost always blocks like sections, container divs, paragraphs and the like - whitespace won't matter here. I would estimate the case of having empty lines separating inline or inline-block elements as somewhat rare, and of course, solvable by either removing that empty line or adding another.

What we would stand to gain is a very clean syntax that (I think?) no other white space based templating system has solved by such a simple mechanism.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions