Bởi vì tôi cảm thấy khó chịu với các thẻ HTML, tôi bắt đầu chuyển đổi dự án của mình thành HAML, vì nó được cấu trúc tốt hơn rất nhiều. Tôi vui mừng việc cài đặt cung cấp công cụ html2haml
để giúp tôi với nó.Thiếu keyword_end về xử lý mẫu từng phần haml
Trong khi là đúng cú pháp, xử lý các tập tin mang lại cho tôi một lỗi lạ Tôi không hoàn toàn nhận được:
/stories/_story.html.haml:28: syntax error, unexpected keyword_ensure, expecting keyword_end
...:Util.html_safe(_erbout);ensure;@haml_buffer = @haml_buffer....
... ^
/stories/_story.html.haml:31: syntax error, unexpected $end, expecting keyword_end
nguồn Haml của tôi chỉ có 27 dòng, và kể từ khi tôi cảm thấy rất mới này, tôi có không biết nó bị sai ở đâu ... ở đây là mã số:
%h1= story.title
%center
%i
by #{link_to story.user.name, story.user}
#story-short= story.short_desc
- if logged_in? and @current_user.id == story.user_id
.list-buttons
%center
= link_to 'Edit', edit_story_path(story)
|
\#{link_to 'Delete', story, :method => 'delete', :confirm => 'Are you really sure?'}
#story-body
- story.body.split("\n").each do |line|
- if line.strip.empty?
%hr/
- else
%p= line.strip
#comments
%p{:onclick => "$('#comments').find('dl').slideToggle();"} Comments to this story (click to expand)
%dl
= render :partial => 'comment', :collection => @story.comments
- if logged_in? and @current_user.id != story.user_id
%dt Leave a comment:
%dd
= form_for [story, story.comments.build] do |f|
.field= f.text_area :body
.actions= f.submit "Comment!"
Vì vậy, tôi thực sự rất muốn biết điều này là sai. Kiểm tra nó nhiều lần, có thể là một lỗi?
Cảm ơn thời gian của bạn.
Một lỗi trong html2haml, có lẽ? Dù sao cũng cảm ơn bạn! –
Tôi quan tâm đến việc sửa nó nếu nó là một lỗi html2haml. Bạn có thể cung cấp ERB ban đầu đã được chuyển đổi thành Haml này không? –