2

我不断收到此错误:

Showing app/views/posts/index.html.haml where line #115 raised:

app/views/posts/index.html.haml:115: syntax error, unexpected keyword_ensure, 
expecting $end

Extracted source (around line #115):

0

Trace of template inclusion: app/views/posts/index.html.haml

Application Trace | Framework Trace | Full Trace

app/controllers/posts_controller.rb:28:in `index'

这是 index.html.haml 文件:

.container-fluid
%br 
.row-fluid 
    .span3 
        .well.sidebar-nav{:style=>'background-color:rgb(999,999,999);'}
            %ul.nav.nav-pills.nav-stacked 
                %li
                    %a{:href => '#'} Todays Best 
                %li 
                    %a{:href => '#'} Yesterdays Best 
                %li 
                    %a{:href => '#'} Weeks Best 
                %li 
                    %a{:href => '#'} Months Best 
                %li 
                    %a{:href => '#'} Hall of Fame 
        .label.label-inverse
            %center
                Todays Best: 
        %table.table.table-bordered.table-condensed{:style=>'background-color:rgb(999,999,999);'}
            - @count= 0
            - @feedcount= 4 #5 best
            - @popularfeed.each do |post|
                - if @count<=@feedcount then
                    %tr
                        %td
                            %center
                                =  truncate(post.content, :length => 132)
                                -  @count= @count +1
                                %br
                            %p{:align => "right"}
                                %span{:style=>'color:green;'}=post.likes
                                %span{:style=>'color:red;'}=post.dislikes
                                %span{:style=>'color:blue;'}=post.prominence
    .span6 
        %center
            %table.table.table-bordered.table-condensed{:style=>'background-color:rgb(999,999,999);'}
            - @mainfeed.each do |post|
                =link_to post do 
                    %tr
                        %td  
                            %center
                                %br
                                =post.content   
                            %p.small{:align => 'right'}
                                3 days ago
                            %center  



                                %span.labelStyle.label.label-success
                                    =link_to 'Agree', :action  =>   'like', :id  =>   post.id
                                    =post.likes 
                                %span.label.label-important.postbar 
                                    =link_to 'Disagree', :action  =>   'dislike', :id  =>   post.id
                                    =post.dislikes 
                                %span.label.label-info.postbar 
                                    =link_to 'Voice', :action => 'prominence', :id  =>  post.id
                                    =post.prominence
                                %span.label.postbar 
                                    %a{:'data-toggle'=>"modal", :'data-target'=>"#myModal"}
                                        Comments
                                        =post.comments.count

                                %span.label.postbar 
                                    Report
                                %br 
                                %br 
                                %tr
                    %td
                        %p
                            %a.btn{:href => '#'} View details &raquo; 
    .span3
        .well{:style=>'background-color:rgb(999,999,999);'}
            =render 'form'  
        -#  .alert.alert-success 
        -#      Post was succesfully made.
    .span3
        .label.label-inverse
            %center Most Controversial:                  
        %table.table.table-bordered.table-condensed{:style=>'background-color:rgb(999,999,999);'}
            - @count= 0            
            - @feedcount= 3  #3 best 
            - @controfeed.each do |post|
                - if @count<=@feedcount then  
                    %tr                                 
                        %td                                       
                            %center                                         
                                =truncate(post.content, :length => 132)             
                                -@count= @count +1
                                %br                                                     
                            %p{:align => "right"}
                                %span{:style=>'color:green;'}=post.likes              
                                %span{:style=>'color:red;'}=post.dislikes     
                                %span{:style=>'color:blue;'}=post.prominence

我相信错误应该在 .span6 中,但我不确定。该文件只有 112 行长,错误在第 115 行。感谢帮助

4

1 回答 1

2

您在 116 和 177 上有两条评论(或者至少,我认为您在代码中评论)没有前缀-

#3 best并且#5 best可能需要成为-#3best-#5best

于 2012-05-01T07:03:20.213 回答