【问题标题】:How to add quote marks to text in HAML code如何在 HAML 代码中为文本添加引号
【发布时间】:2012-06-14 05:29:14
【问题描述】:

我有以下 HAML 代码

//add some text
%div.text
  <%= answer.text %>

浏览器中的结果是这样的

如何在此文本中添加引号,以便改为显示“test remuse”?

【问题讨论】:

  • 使用&lt;%= "#{answer.text}" %&gt; 可能有效。
  • 你是怎么运行这个的? &lt;%= .. %&gt; 是 erb,而不是 Haml。看起来你把 Haml 和 erb 混为一谈了。

标签: haml double-quotes


【解决方案1】:

更自然的解决方案:

//add some text
%div.text
  "#{answer.text}"

我认为你不需要%div,因为.textdivclass="text"

.text
  "#{answer.text}"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-18
    • 1970-01-01
    • 1970-01-01
    • 2017-07-06
    相关资源
    最近更新 更多