diff --git a/lib/sass/tree/attr_node.rb b/lib/sass/tree/attr_node.rb index f5bba4a4..2d128bf9 100644 --- a/lib/sass/tree/attr_node.rb +++ b/lib/sass/tree/attr_node.rb @@ -48,13 +48,13 @@ module Sass::Tree end if value[-1] == ?; - raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump} (This isn't CSS!).", @line) + raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump} (no \";\" required at end-of-line).", @line) end real_name = name real_name = "#{parent_name}-#{real_name}" if parent_name if value.empty? && children.empty? - raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump}.", @line) + raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump} (no value).", @line) end join_string = case style @@ -103,7 +103,7 @@ module Sass::Tree private def declaration - ":#{name} #{value}" + @attr_syntax == :new ? "#{name}: #{value}" : ":#{name} #{value}" end end end diff --git a/test/sass/engine_test.rb b/test/sass/engine_test.rb index e771dae6..68ce641d 100755 --- a/test/sass/engine_test.rb +++ b/test/sass/engine_test.rb @@ -18,11 +18,13 @@ class SassEngineTest < Test::Unit::TestCase ":" => 'Invalid attribute: ":".', ": a" => 'Invalid attribute: ": a".', ":= a" => 'Invalid attribute: ":= a".', - "a\n :b" => 'Invalid attribute: ":b ".', + "a\n :b" => 'Invalid attribute: ":b " (no value).', + "a\n b:" => 'Invalid attribute: "b: " (no value).', "a\n :b: c" => 'Invalid attribute: ":b: c".', "a\n :b:c d" => 'Invalid attribute: ":b:c d".', "a\n :b=c d" => 'Invalid attribute: ":b=c d".', - "a\n :b c;" => 'Invalid attribute: ":b c;" (This isn\'t CSS!).', + "a\n :b c;" => 'Invalid attribute: ":b c;" (no ";" required at end-of-line).', + "a\n b: c;" => 'Invalid attribute: "b: c;" (no ";" required at end-of-line).', "a\n b : c" => 'Invalid attribute: "b : c".', "a\n b=c: d" => 'Invalid attribute: "b=c: d".', ":a" => 'Attributes aren\'t allowed at the root of a document.',