对于HAML,需要使用严格的嵌套级别EVEN INSIDE COMMENTS?

时间:2011-03-21 23:42:00

标签: ruby-on-rails haml

如下面的HAML评论代码:

/ 
  We don't want to use

    foobar(something, something_else, ...)

  here

它会失败,因为HAML希望缩进级别为2个空格,而foobar行缩进4个空格...加上...严格缩进...即使在注释中?这不是一个错误吗? (或一个合理的功能?)

1 个答案:

答案 0 :(得分:2)

尝试使用:plain明文过滤器,记录here

/ 
  :plain
    We don't want to use

      foobar(something, something_else, ...)

    here

-# this is a comment
  going to a second line
    indented extra on the third line
  and normally on the fourth

哪个为我输出:

>haml --version
Haml/Sass 3.0.25 (Classy Cassidy)

>haml test.haml
<!--
  We don't want to use

    foobar(something, something_else, ...)

  here
-->