The following code leaves a white space in HTML:
= link_to "Login", "#"
Normally, HAML allows to remove it by putting ">" at the end of the line, for example:
%input#query{:type => "text", :value => "Search"}>
However, that seems to be impossible, when Rails code is inserted.
How do I fix this?
The solution with span is not ideal as it adds an unnecessary html tag that will require processing, if you want to avoid the <span>
you should use HAML's succeed
:
= succeed "," do
= link_to "Login", "#"
which will result in the following HTML being rendered:
Login,
rather than
Login ,
Note that if you want to achieve the following result:
Login,Profile
i.e. no whitespace whatsoever between the comma and two links you should do the following:
= succeed link_to "Profile", '#' do
= succeed "," do
= link_to "Login", '#'
which gets pretty tedious