私は複数のブログや私のアプリ/ビュー/レイアウト/ application.html.hamlファイルを実行するための簡単なアプリケーションをセットアップしようとしているが、次のようになりますレール、工夫とHAML:構文エラー、予期しないkELSE
!!!
%html
%head
%title Brimble's Blogs
= stylesheet_link_tag "application", :media => "all"
= javascript_include_tag "application"
= csrf_meta_tags
%body
%p.notice= notice
%p.alert= alert
.user-auth-nav{style => 'float:right'}
= if user_signed_in?
= link_to('Edit registration', edit_user_registration_path)
= link_to('Logout', destroy_user_session_path)
= else
= link_to('Login', new_user_session_path)
= link_to('Register', new_user_registration_path)
= end
= yield
私が手にエラーがある:
compile error
<myapp>/app/views/layouts/application.html.haml:18: syntax error, unexpected kELSE
<myapp>/app/views/layouts/application.html.haml:22: syntax error, unexpected kEND
<myapp>/app/views/layouts/application.html.haml:23: unknown regexp options - htl
<myapp>/app/views/layouts/application.html.haml:23: syntax error, unexpected $undefined
));}\n </div>\n</html>\n#{_hamlout.adjust_tabs(-2); _...
^
<myapp>/app/views/layouts/application.html.haml:25: syntax error, unexpected kENSURE, expecting $end
抽出されたソース(ライン#18の周り):
15: = link_to('Edit registration', edit_user_registration_path)
16: = link_to('Logout', destroy_user_session_path)
17: = else
18: = link_to('Login', new_user_session_path)
19: = link_to('Register', new_user_registration_path)
20: = end
21:
私はTUを以下のよこのページのtorial: http://www.logansbailey.com/2011/02/27/adding-authorization-using-devise/ このチュートリアルでは、erbを使用していますが、私は実際にHamlのアイデアが好きなので、私はそれに行きたいです。事前
答えを見つけた 最初に、私は '= end'を必要とせず、第二に、' = if'を '-if'に変更しました。 – brimble2010