Search code examples
rubyhamlc

How do I remove white space between link and period in hamlc


Here is my hamlc code:

%a{href: 'http://www.google.com'} hello
\.

This results in the following output:

<a href="http://www.yahoo.com">hello</a>
.

The line break results in a space between the link and the period.

How can I avoid this?


Solution

  • Haml has a whitespace-removal character >. Place it right after your tag to remove surrounding whitespace:

    %a{href: 'http://www.google.com'}> hello
    \.
    

    Output:

    <a href='http://www.google.com'>hello</a>.