更新时间:2023-11-22 13:50:46
不幸的是,您不能在同一行上放置两个haml元素.
Unfortunately, you cannot put two haml elements on the same line.
您可以通过使用内联html元素来实现类似的目的:
You can achieve something similar by using inline html elements:
%h1 <a href='/'>Lorem ipsum</a>
您为什么不喜欢这种格式?
Why don't you like this format?
%h1
%a{:href => '/'} Professio.
另一个选择是编写特殊的"helper"方法(生成html链接).例如,Rails中的link_to:
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