0

我正在尝试使用 tab_up 和 tab_down haml-helper。我的理解是,在 tab_up 之后下一行应该缩进。

这个haml代码...

%h1 foo
- tab_up
%p bar
- tab_down
%strong baz

应该产生这个html...

<h1>foo</h1>
  <p>bar</p>
<strong>baz</strong>

但就我而言,它会产生...

<h1>foo</h1>
<p>bar</p>
<strong>baz</strong>

将haml更改为...

%h1 foo
= tab_up
%p bar
= tab_down
%strong baz

导致...

<h1>foo</h1>
1
<p>bar</p>
0
<strong>baz</strong>

因此,选项卡的计数似乎运行正确,但在创建输出时不考虑它们。其他 haml-helpers 运行良好。使用 tab_up 和 tab_down 时是否需要考虑其他任何因素?

我正在使用 Rails 3.2.8、Ruby 1.9.2、Windows7

4

1 回答 1

0

您在哪里寻找“查看”html?我刚刚为我测试了这个,它在页面源中正常工作。如果您在 firebug 或类似工具中查看它,它不会显示缩进。

于 2012-11-16T15:16:06.533 回答