I want to be able to have two Haml elements on the same line. For example:
%h1 %a{:href => '/'} Professio.
That doesn't work. How would I get something like this to work without borking?
I want to be able to have two Haml elements on the same line. For example:
%h1 %a{:href => '/'} Professio.
That doesn't work. How would I get something like this to work without borking?
You can do so, beacause haml elements can not be online
%h1 <a href='/'>Lorem ipsum</a>
Why you wouldn't like this solution?
%h1
%a{:href => '/'} Professio.
You can write special 'helper' method(that generate html link) for this cases like link_to in Rails.
%h1= link_to 'Professio', root_url
If you're looking to preserve the HTML on the same line you could try something like this:
irb(main):045:0> print Haml::Engine.new("%h1<\n %a{:href => '/'} Profession.").render()
<h1><b href='/'>Profession.</a></h1>
Found here: HAML whitespace removal
[Edit: I know that's says b href above...]