我正在尝试设置一个简单的应用程序来运行多个博客,我的 app/views/layouts/application.html.haml 文件如下所示:
!!!
%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:
我正在关注此页面上的教程: http ://www.logansbailey.com/2011/02/27/adding-authorization-using-devise/ 该教程使用 erb 但我真的很喜欢 Haml 的想法,所以我想搏一搏。
提前致谢