将此html翻译为haml

时间:2016-01-13 08:57:26

标签: html ruby-on-rails haml

我试图将这个html翻译成haml。我使用http://html2haml.herokuapp.com/http://htmltohaml.com/但没有成功。

<li class="nav-item btn-group" data-behavior="notifications" data-notifications='<%= render template: "notifications/index", formats: [:json] %>'>
</li>

他们给我这两个:

%li.nav-item.btn-group{"data-behavior" => "notifications", "data-notifications" => render template: "notifications/index", formats: [:json]}

但我有一个运行它的SyntaxError。 有人能帮助我吗?

2 个答案:

答案 0 :(得分:0)

我希望这个有效,

%li.nav-item.btn-group{"data-behavior" => "notifications", "data-notifications" => (render partial: "notifications/index")}

答案 1 :(得分:0)

%li.nav-item.btn-group{ :data => { :behavior => "notifications", :notifications => (render template: "notifications/index", formats: [:json]) }}