在haml中添加行之间的图像

时间:2015-11-26 10:27:45

标签: html image haml

我想要以haml显示以下文字。

<div class="myclass">
My long text here. My word's ...
<img src="link" class="mylinkclass">
</div>

注意单词中的'。我尝试了很多这样的事情并花了几个小时。

%li.event.right
   .header= l("'EGR Operator Award for Financial Betting Operator'")
     .event-body!= l(" My long text's . %img{:class => "responsive" :src => url_for("images/pages/img.jpg")} ")

上述代码失败。我试过了

 %li.event.right
    .header= l("'EGR Operator Award for Financial Betting Operator'")
         .event-body!= l(" My long text's . <img class ="responsive" src => url_for("images/pages/img.jpg") ")
在这种情况下,

url_for无法识别。请问我该如何实现?任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

请试试这个:

%li.event.right
  .header= l("'EGR Operator Award for Financial Betting Operator'")
    .event-body
      = l(" My long text's")
      %img{:class => "responsive" :src => url_for("images/pages/img.jpg")}
是的,你知道这个页面吗? http://html2haml.herokuapp.com/