我試圖切換到使用HAML作爲我的意見,但我不斷收到意想不到的KENSURE消息。我用html2haml來切換工作視圖文件。首先運行它告訴我,我不需要html2haml在其輸出中的結尾,所以我刪除了它,現在我得到的錯誤看起來像是抱怨表單沒有被結束。Rails HAML轉換問題 - 意外kENSURE,期待kEND
我在做什麼錯?
錯誤消息:
compile error
app/views/sessions/new.html.haml:20: syntax error, unexpected kENSURE, expecting kEND
app/views/sessions/new.html.haml:22: syntax error, unexpected $end, expecting kEND
application.html.haml:
!!!
%html
%head
%title
= APP_CONFIG[:site_name] + ': ' + @page_title
== <meta http-equiv="content-type" content="text/xhtml; charset=utf-8" />
== <meta http-equiv="imagetoolbar" content="no" />
== <meta name="distribution" content="all" />
== <meta name="robots" content="all" />
== <meta name="resource-type" content="document" />
== <meta name="MSSmartTagsPreventParsing" content="true" />
= stylesheet_link_tag 'base'
= javascript_include_tag :defaults
%body
#container
#header
- if logged_in?
= link_to 'Logout', logout_path
- else
= link_to 'Login', login_path
= link_to 'Signup', signup_path
#content
= flash_messages
= yield :layout
和會話/ new.html.haml
= title "Login", :h2
- form_tag session_path do
%fieldset
%legend
Your Details
%ol
%li
= label_tag 'login', 'Username'
= text_field_tag 'login', @login
%li
= label_tag 'password'
= password_field_tag 'password', nil
%li
= label_tag 'remember_me', 'Remember me'
= check_box_tag 'remember_me', '1', @remember_me
.buttons
= submit_tag 'Login'
= link_to 'Forgotten Password', forgot_password_path
這就是解決方案,但我認爲這調試會話已經完全把我關HAML的。與必須處理難以理解的空白分析錯誤相比,關閉幾個括號是無關緊要的。按鈕類也需要縮進,meta標籤被HTML2HAML轉換成ruby哈希值。太多的奇怪怪癖在這個DSL我喜歡 – srboisvert 2009-06-09 19:05:15