mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Make '- end' an error in Haml with a useful error message.
This commit is contained in:
parent
82a2571e68
commit
b54ff8dbe6
2 changed files with 15 additions and 0 deletions
|
@ -197,6 +197,14 @@ END
|
|||
when SILENT_SCRIPT
|
||||
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:
|
||||
- if foo?
|
||||
%strong Foo!
|
||||
- else
|
||||
Not foo.
|
||||
END
|
||||
|
||||
push_silent(text[1..-1], true)
|
||||
newline_now
|
||||
if (@block_opened && !mid_block_keyword?(text)) || text[1..-1].split(' ', 2)[0] == "case"
|
||||
|
|
|
@ -34,6 +34,13 @@ END
|
|||
"%a/ b" => "Self-closing tags can't have content.",
|
||||
" %p foo" => "Indenting at the beginning of the document is illegal.",
|
||||
" %p foo" => "Indenting at the beginning of the document is illegal.",
|
||||
"- end" => <<END.rstrip,
|
||||
You don't need to use "- end" in Haml. Use indentation instead:
|
||||
- if foo?
|
||||
%strong Foo!
|
||||
- else
|
||||
Not foo.
|
||||
END
|
||||
" \n\t\n %p foo" => ["Indenting at the beginning of the document is illegal.", 3],
|
||||
|
||||
# Regression tests
|
||||
|
|
Loading…
Add table
Reference in a new issue