whitespaces #93

Closed
punund opened this Issue Oct 16, 2012 · 13 comments

Comments

Projects
None yet
2 participants

punund commented Oct 16, 2012

I find it very difficult to insert trailing whitespaces into element's content:

    span price: 
    input(type='text')

I would like it to render as

    <span>price: </price><input type="text">

Trailing spaces are, however, get truncated. Jade, on the other hand, preserves them.

bminer was assigned Oct 16, 2012

Owner

bminer commented Oct 16, 2012

That doesn't sound right to me. Blade also preserves trailing whitespace. :)

And... it also preserves leading whitespace.

span testing (that's "span", followed by two spaces, followed by "testing") renders to:

<span> testing</span>

bminer closed this Oct 16, 2012

punund commented Oct 16, 2012

Your are right. My bad.

Owner

bminer commented Oct 16, 2012

No problem.

punund commented Feb 7, 2013

Maybe it's unrelated, but how do I put a whitespace between elements:

input(type="text")
input(type="text")

result is

<input type="text"><input type="text">

desired

<input type="text"> <input type="text">

In Bootstrap controls get glued together...

Owner

bminer commented Feb 8, 2013

That's an easy one. :)

input(type="text")
|  
input(type="text")

Notice that after the pipe character |, there are two spaces. A bit tricky, but I've gotten used to it.

punund commented Feb 8, 2013

Well yes, I just thought that maybe it's worthwhile to have a shorthand notation, given that this is quite common, saving the line for just one whitespace:

input+(type="text")

Or whatever looks better. Besides, trailing spaces are already not too easy to notice, let alone to count them. I have to squint, personally.

Owner

bminer commented Feb 8, 2013

Hmmm... you have a good point. So, your suggested solution is to follow tag names with a + to append a trailing space to the element. Is that correct? If so, I must ask... according to the XML spec, can element names contain plus characters? And, are you sure about a plus sign? IMHO, it looks just as strange as the pipe character and two spaces.

I'm open to ideas. Any thoughts on this?

punund commented Feb 9, 2013

Plus characters can not be in an XML tag. I don't insist on this notation. Maybe > is a better choice, with cultural reference to HAML, and this certainly cannot be perceived as a part of the name. This may look as strange as the pipe, but it won't take up extra line, and won't make us wonder how many spaces there are after each standalone pipe.

Blade is so great at saving keystrokes, but here it forces 3 symbols and a line feed to denote just one space. I believe that the pipe should introduce some meaningful text, and this just looks like a hack.

Owner

bminer commented Feb 11, 2013

Alright. I'll create a separate issue for this.

Owner

bminer commented Feb 11, 2013

Er... no I won't. I'll just re-open this one and re-tag it. Thanks!

bminer reopened this Feb 11, 2013

Owner

bminer commented Feb 11, 2013

By the way, > is what I will use if HAML uses that. Thanks for doing some research on this.

bminer closed this in 8d8eba1 Mar 7, 2013

Owner

bminer commented Mar 7, 2013

punund commented Mar 7, 2013

👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment