Multiple Haml Elements on Same Line

后端 未结 4 1295
悲&欢浪女
悲&欢浪女 2020-12-16 17:00

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

4条回答
  •  情深已故
    2020-12-16 17:57

    Unfortunately, you cannot put two haml elements on the same line.

    You can achieve something similar by using inline html elements:

    %h1 Lorem ipsum
    

    Why don't you like this format?

    %h1 
      %a{:href => '/'} Professio.
    

    Another option is to write special 'helper' method (that generate an html link). For example, the link_to in Rails:

    %h1= link_to 'Professio', root_url
    

提交回复
热议问题