【问题标题】:Haml error: syntax error, unexpected keyword_ensure, expecting end-of-input ...:Util.html_safe(_erbout);ensure;@haml_buffer = @haml_buffer.... ... ^Haml 错误:语法错误,意外的keyword_ensure,期待输入结束...:Util.html_safe(_erbout);ensure;@haml_buffer = @haml_buffer.... ... ^
【发布时间】:2015-10-15 09:47:41
【问题描述】:

我收到这样的错误:

实际上我也使用 2 个空格的 haml 语法。使用 haml 标签它可以工作,而使用 ruby​​ 代码则不行。大佬们怎么解决呢?

代码如下:

    %li
      = image_tag('leaf.jpg')
        .caption
          .slide-text-info.bounceInDown{"data-wow-delay" => "0.4s"}
            %h1 welcome to our marketplace
            %p Lorem ipsum dolor sit amet, consectetur adipisicing elit.Sed nisi metus,tristique ndolor non,ornare sagittis dolor.Nulla vestibulu lacus...
            .slide-btns
              %a.startnow{:href => "#"} VIWE MORE
              %a.livedemo{:href => "#"} VIDEO TOUR

【问题讨论】:

  • 截图很难看。请分享代码。
  • 尝试用=替换-
  • 是的,我知道并且在代码中我这样做了,但仍然是同样的问题

标签: html ruby-on-rails ruby haml


【解决方案1】:

尝试将内容放入块中:

%li
  = image_tag('leaf.jpg') do
    .caption
      .slide-text-info.bounceInDown{"data-wow-delay" => "0.4s"}
        %h1 welcome to our marketplace
        %p Lorem ipsum dolor sit amet, consectetur adipisicing elit.Sed nisi metus,tristique ndolor non,ornare sagittis dolor.Nulla vestibulu lacus...
        .slide-btns

          %a.startnow{:href => "#"} VIWE MORE
          %a.livedemo{:href => "#"} VIDEO TOUR

(注意image_tag后面的do

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-17
    • 2012-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-19
    相关资源
    最近更新 更多