How do I get rid of the extra whitespace in html provided by Haml & Ruby?
I am trying to format a simple sentence that reads like this:
When my haml looks like this:
%a{:href => "link", :target=> '_blank'} x,
%a{:href => "link", :target=> '_blank'} y,
and
%a{:href => "link", :target=> '_blank'} z.
I get
When my haml looks a little different:
%a{:href => "link", :target=> '_blank'} x
,
%a{:href => "link", :target=> '_blank'} y
, and
%a{:href => "link", :target=> '_blank'} z
.
I get
... and the spaces don't look right.
How can I make it look the way I want it to?
I want him to look like
... with non-link commas and periods and no extra spaces.
+3
source to share
5 answers
I had similar problems, you could try
Helpers#succeed
eg.
= succeed ',' do
%a{:href=>"link"}x
= succeed ',' do
%a{:href=>"link"}y
0
source to share
EDIT due to my misunderstanding, I gave you the wrong solution, this might be what you need:
You must use
success
from haml helper:
= succeed ',' do
%a{:href => "link", :target=> '_blank'}x
= succeed ',' do
%a{:href => "link", :target=> '_blank'}y
= succeed '.' do
%a{:href => "link", :target=> '_blank'}z
-1
source to share