0

我无法将 HTML 语法转换为 HAML。

我知道一个<div>类可以简单地表示为:

.class-name

但是,我想将以下语法转换为 HAML,并在标题中加入一个变量:

<div title="My title" class="my-text">This is my title</div>

就像是:

.title{@ruby-variable}.my-text
4

2 回答 2

1
.my-text{:title => "My title"} This is my title

在你使用的haml中#someid.someclass{:custom_attr => "something"}:costum_attr如果您需要动态定义它,也可以是类或 id。

于 2013-04-30T19:09:32.177 回答
1

尝试这个:

.my-text{:title => 'My title'} This is my title

或另一种语法:

.my-text(title = 'My title') This is my title
于 2013-04-30T19:10:14.950 回答