簡體   English   中英

語法錯誤,意外的keyword_else,預期的keyword_end

[英]syntax error, unexpected keyword_else, expecting keyword_end

我正在使用SLIM,但不確定如何修復縮進。 我看到此錯誤:

/ users / user語法錯誤處的SyntaxError,意外的keyword_else,期望的keyword_end; 其他; ^ /views/users/shared/_user_item.html.slim:18:語法錯誤,意外的keyword_ensure,期望輸入結束

來自此文件:

li
  .common_box.box3
    .img_box
        = link_to user do
          - if user.avatar.present?
          img alt="" src="#{user.avatar.try(:image_url, :similar)}" style=("width: 194px;height: 139px;")  /
          - else
            img alt="no image" src="" style=("width: 194px;height: 139px;") /
    .img_detail
      small years
      .circle
        span.age_box = user.age 
      h3 #{user.username} #{current_user.location.state}
      h4 #{user.location.city}, #{user.location.state}
      .green_corner
        img alt="" src="/assets/side_curv.png" /

line 6嘗試這個(您的圖片標簽沒有縮進)。

li
  .common_box.box3
    .img_box
        = link_to user do
          - if user.avatar.present?
            img alt="" src="#{user.avatar.try(:image_url, :similar)}" style=("width: 194px;height: 139px;")  /
          - else
            img alt="no image" src="" style=("width: 194px;height: 139px;") /
    .img_detail
      small years
      .circle
        span.age_box = user.age 
      h3 #{user.username} #{current_user.location.state}
      h4 #{user.location.city}, #{user.location.state}
      .green_corner
        img alt="" src="/assets/side_curv.png" /

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM