0
我有這個簡單的HAML觀點,admin.html.haml
:很多在HAML視圖中的語法錯誤(使用大禮包引擎)
!!!
%html{:xmlns => "http://www.w3.org/1999/xhtml"}
%head{"data-hook" => "admin_inside_head"}
(視圖是相當大的,我刪除了大部分爲清楚起見)
要http://localhost:3000/admin
我得到:
SyntaxError in Spree/admin/overview#index
Showing /Users/panayi/Dropbox/Sites/RAILS/engines/core/app/views/spree/layouts/admin.html.haml where line #2 raised:
/Users/panayi/Dropbox/Sites/RAILS/engines/core/app/views/spree/layouts/admin.html.haml:2: syntax error, unexpected '=', expecting ')'
...ut.attributes({}, nil, :xmlns => "http://www.w3.org/1999/...
... ^
/Users/panayi/Dropbox/Sites/RAILS/engines/core/app/views/spree/layouts/admin.html.haml:2: syntax error, unexpected ')', expecting '}'
..."http://www.w3.org/1999/xhtml")}>\n <head#{_hamlout.adjust_...
... ^
/Users/panayi/Dropbox/Sites/RAILS/engines/core/app/views/spree/layouts/admin.html.haml:3: syntax error, unexpected '=', expecting ')'
...tributes({}, nil, "data-hook" => "admin_inside_head")}></...
... ^
/Users/panayi/Dropbox/Sites/RAILS/engines/core/app/views/spree/layouts/admin.html.haml:3: syntax error, unexpected ')', expecting '}'
...ook" => "admin_inside_head")}></head>\n</html>\n", -1, fa...
... ^
/Users/panayi/Dropbox/Sites/RAILS/engines/core/app/views/spree/layouts/admin.html.haml:3: unknown regexp options - htl
/Users/panayi/Dropbox/Sites/RAILS/engines/core/app/views/spree/layouts/admin.html.haml:3: syntax error, unexpected $undefined
...nside_head")}></head>\n</html>\n", -1, false);::Haml::Util.h...
... ^
/Users/panayi/Dropbox/Sites/RAILS/engines/core/app/views/spree/layouts/admin.html.haml:3: unterminated string meets end of file
/Users/panayi/Dropbox/Sites/RAILS/engines/core/app/views/spree/layouts/admin.html.haml:3: syntax error, unexpected $end, expecting '}'
Extracted source (around line #2):
1: !!!
2: %html{:xmlns => "http://www.w3.org/1999/xhtml"}
3: %head{"data-hook" => "admin_inside_head"}
Trace of template inclusion: /Users/panayi/Dropbox/Sites/RAILS/engines/core/app/views/spree/layouts/admin.html.haml
引入haml寶石正確裝入(與HAML六搞亂ew indentation我得到了一個Haml :: SyntaxError),並且在把spree視圖切換到haml之前,它可以和erb視圖一起工作。
任何人都可以建議要檢查什麼,以解決錯誤?
奇怪的是,語法看起來很好。事實上,我把它放到我的佈局文件中,對我來說它很好。當然,我沒有使用Spree,但這應該沒有區別,我會推測。 – iwasrobbed 2012-01-10 22:08:19
順便說一下,在HAML中,修正一個錯誤通常會修復所有錯誤。所以即使它顯示了大量的錯誤,它可能只與一件事有關(我很抱歉說我不能幫你)。您可能想嘗試將此問題發佈到HAML Google羣組 – iwasrobbed 2012-01-11 05:45:33