[Haml] Make the - end error message better.

This commit is contained in:
Nathan Weizenbaum 2010-03-06 14:34:22 -08:00
parent a66ba5be6d
commit d39340fc52
2 changed files with 4 additions and 1 deletions

View File

@ -13,6 +13,8 @@
According to [this bug report](http://github.com/carlhuda/bundler/issues/issue/44),
this should make Haml work better with Bundler.
* Make the error message for `- end` a little more intuitive based on user feedback.
## 2.2.20
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.20).

View File

@ -245,11 +245,12 @@ END
return start_haml_comment if text[1] == SILENT_COMMENT
raise SyntaxError.new(<<END.rstrip, index) if text[1..-1].strip == "end"
You don't need to use "- end" in Haml. Use indentation instead:
You don't need to use "- end" in Haml. Un-indent to close a block:
- if foo?
%strong Foo!
- else
Not foo.
%p This line is un-indented, so it isn't part of the "if" block
END
push_silent(text[1..-1], true)