From bf5049cfca240f1b82472f445ab2a9bff59bd3bb Mon Sep 17 00:00:00 2001 From: nex3 Date: Fri, 30 Mar 2007 06:49:03 +0000 Subject: [PATCH] Hard tabs in empty lines in Haml and Sass no longer throw errors. git-svn-id: svn://hamptoncatlin.com/haml/trunk@459 7063305b-7217-0410-af8c-cdc13e5119b9 --- lib/haml/engine.rb | 2 ++ lib/sass/engine.rb | 3 +++ test/haml/templates/just_stuff.haml | 2 ++ test/sass/templates/complex.sass | 3 +++ 4 files changed, 10 insertions(+) diff --git a/lib/haml/engine.rb b/lib/haml/engine.rb index d18c1cd2..c9b0a07f 100644 --- a/lib/haml/engine.rb +++ b/lib/haml/engine.rb @@ -716,6 +716,8 @@ END def count_soft_tabs(line) spaces = line.index(/[^ ]/) if line[spaces] == ?\t + return nil if line.strip.empty? + raise SyntaxError.new("Illegal Indentation: Only two space characters are allowed as tabulation.") end [spaces, spaces/2] diff --git a/lib/sass/engine.rb b/lib/sass/engine.rb index f7761e6c..87b758af 100644 --- a/lib/sass/engine.rb +++ b/lib/sass/engine.rb @@ -142,6 +142,9 @@ module Sass spaces = line.index(/[^ ]/) if spaces if spaces % 2 == 1 || line[spaces] == ?\t + # Make sure a line with just tabs isn't an error + return nil if line.strip.empty? + raise SyntaxError.new("Illegal Indentation: Only two space characters are allowed as tabulation.", @line) end spaces / 2 diff --git a/test/haml/templates/just_stuff.haml b/test/haml/templates/just_stuff.haml index dd1d247e..5582e986 100644 --- a/test/haml/templates/just_stuff.haml +++ b/test/haml/templates/just_stuff.haml @@ -39,6 +39,8 @@ Woah a period. = "test" | "test" | +-# Hard tabs shouldn't throw errors. + - case :foo - when :bar %br Blah diff --git a/test/sass/templates/complex.sass b/test/sass/templates/complex.sass index 6163f6c5..7e79503a 100644 --- a/test/sass/templates/complex.sass +++ b/test/sass/templates/complex.sass @@ -109,6 +109,9 @@ body a:hover :text-decoration underline +// A hard tab: + + #content p, div :width 40em