Hi,
I understand that "<% -%>" doesn't make a new line in output. But what's "<%- -%>"?
According to http://wiki.rubyonrails.org/rails/pages/FAQ#other ,
How is <%- different from <% ? Apparently nobody knows.
Would it better to use <%- ? What's the best practice?
Does anybody avoid the start tag and tweak "Toggle ERb Tags" command?
Takaaki
On Dec 16, 2007, at 5:02 AM, Takaaki Kato wrote:
I understand that "<% -%>" doesn't make a new line in output. But what's "<%- -%>"?
It trims space before, like an indent, and after the inserted content.
Would it better to use <%- ? What's the best practice?
Well, it would be better if you want to trim whitespace on both sides and worse if you do not.
Does anybody avoid the start tag and tweak "Toggle ERb Tags" command?
I don't know if they do, but you certainly can. That script is pretty simple and shouldn't be too hard to understand. Check it out.
James Edward Gray II
On Dec 17, 2007, at 1:50 AM, James Gray wrote:
On Dec 16, 2007, at 5:02 AM, Takaaki Kato wrote:
I understand that "<% -%>" doesn't make a new line in output. But what's "<%- -%>"?
It trims space before, like an indent, and after the inserted content.
Would it better to use <%- ? What's the best practice?
Well, it would be better if you want to trim whitespace on both sides and worse if you do not.
Does anybody avoid the start tag and tweak "Toggle ERb Tags" command?
I don't know if they do, but you certainly can. That script is pretty simple and shouldn't be too hard to understand. Check it out.
Thanks. Looks like that a book I'm reading only mentions "<% -%>". Now I got the true meaning of the minus sign.
Thanks, James.
Takaaki
On a related note,
if I use <%- (the start tag stats with minus-sign), syntax coloring doesn't behave nicely.
Is this specific to certain themes or scoping issues? Or is this an expected behavior?
Takaaki