mahemoff
mahemoff

Reputation: 46509

Non-breaking space between lines

How could I join two HAML lines with a non-breaking space (& nbsp;) and no actual space, e.g.:

= 'foo'
%a(href='http://example.com') bar

I tried using the succeed helper, but a space is still generated between them. I want to remove the space.

Upvotes: 1

Views: 3891

Answers (1)

Dave Newton
Dave Newton

Reputation: 160321

How did you use succeed? Where did the space end up?

Did you combine it with the whitespace removal chars ("<" and ">") or try them on their own?

= succeed '&nbsp;'.html_safe do
  = 'foo'
%a(href='http://example.com')> bar

This produces:

foo&nbsp;<a href='http://example.com'>bar</a>

Is that literally what you want? It is "two lines joined by a non-breaking space with no actual space."

(IMO, HAML is meh for inline content, and just no fun. Nice for layout.)

Upvotes: 3

Related Questions