【问题标题】:HAML - what does the "!=" operator do?HAML - “!=”运算符做什么?
【发布时间】:2013-03-19 01:19:24
【问题描述】:

我现在正在查看一些看似标准的 Haml 代码,但只是注意到它以“!=”开头,并且 5 分钟的谷歌搜索未能给我答案:

#What does the '!=' mean? 
!= cache_content_if_not_prefetched(params) do
  -if product_live?
    =render :partial => 'products/product_tile'
  -else
    =render :partial => 'products/unavailable_product_tile'

【问题讨论】:

    标签: ruby-on-rails haml


    【解决方案1】:

    与使用 = 相同,但不清理 HTML

    http://haml.info/docs/yardoc/file.REFERENCE.html#unescaping_html

    != "Look  <up>!"
    

    编译成

    Look <up>!
    

    而不是

    Look &ltg;up&gt;
    

    【讨论】:

      【解决方案2】:

      【讨论】:

        【解决方案3】:

        阅读此HAML Documentation。它会给你所有你需要的答案。我刚刚搜索了 HAML 标签。

        为 != 执行 CTRL+F。 != 基本上像 equals 一样评估 Ruby 代码

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2014-09-16
          • 2013-08-08
          • 1970-01-01
          • 2017-10-09
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多