1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Error out when the first line is indented.

This commit is contained in:
Nathan Weizenbaum 2008-05-29 19:07:12 -07:00
parent 2b6c6f6c6c
commit 818349836e
2 changed files with 7 additions and 0 deletions

View file

@ -84,6 +84,10 @@ module Haml
@merged_text = ''
@tab_change = 0
if @template =~ /\A(\n*)[ \t]+/
raise SyntaxError.new("Indenting at the beginning of the document is illegal.", $1.size)
end
if @options[:filters]
warn <<END
DEPRECATION WARNING:

View file

@ -32,6 +32,9 @@ END
".= a" => "Illegal element: classes and ids must have values.",
"%p..a" => "Illegal element: classes and ids must have values.",
"%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.",
"\n\n %p foo" => ["Indenting at the beginning of the document is illegal.", 3],
# Regression tests
"- raise 'foo'\n\n\n\nbar" => ["foo", 1],