Accidental CSS-like attributes now throw errors.
git-svn-id: svn://hamptoncatlin.com/haml/trunk@342 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
parent
4058e4d147
commit
0840be5e24
|
@ -10,6 +10,9 @@ module Sass::Tree
|
|||
end
|
||||
|
||||
def to_s(parent_name = nil)
|
||||
if name[-1] == ?: || value[-1] == ?;
|
||||
raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump} (This isn't CSS!)", @line)
|
||||
end
|
||||
real_name = name
|
||||
real_name = "#{parent_name}-#{real_name}" if parent_name
|
||||
if children.size > 0
|
||||
|
@ -18,11 +21,17 @@ module Sass::Tree
|
|||
to_return[0...-1]
|
||||
else
|
||||
if value.length < 1
|
||||
raise Sass::SyntaxError.new("Invalid attribute: \":#{name} #{value}\"", @line)
|
||||
raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump}", @line)
|
||||
end
|
||||
|
||||
"#{real_name}: #{value};"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def declaration
|
||||
":#{name} #{value}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,8 @@ class SassEngineTest < Test::Unit::TestCase
|
|||
": a" => 'Invalid attribute: ": a"',
|
||||
":= a" => 'Invalid attribute: ":= a"',
|
||||
"a\n :b" => 'Invalid attribute: ":b "',
|
||||
"a\n :b: c" => 'Invalid attribute: ":b: c" (This isn\'t CSS!)',
|
||||
"a\n :b c;" => 'Invalid attribute: ":b c;" (This isn\'t CSS!)',
|
||||
":a" => 'Attributes aren\'t allowed at the root of a document.',
|
||||
"!" => 'Invalid constant: "!"',
|
||||
"!a" => 'Invalid constant: "!a"',
|
||||
|
|
|
@ -12,9 +12,9 @@ body { margin: 0; font: 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-se
|
|||
#header .status a:hover { text-decoration: underline; }
|
||||
#header .search { float: right; clear: right; margin: 12px 0 0 0; }
|
||||
#header .search form { margin: 0; }
|
||||
#header .search input { margin: 0 3px 0 0; padding:: 2px; border:: none; }
|
||||
#header .search input { margin: 0 3px 0 0; padding: 2px; border: none; }
|
||||
|
||||
#menu { clear: both; text-align: right; height: 20px; border-bottom: 5px solid #006b95; background:: #00a4e4; }
|
||||
#menu { clear: both; text-align: right; height: 20px; border-bottom: 5px solid #006b95; background: #00a4e4; }
|
||||
#menu .contests ul { margin: 0 5px 0 0; padding: 0; }
|
||||
#menu .contests ul li { list-style-type: none; margin: 0 5px; padding: 5px 5px 0 5px; display: inline; font-size: 1.1em; color: #fff; background: #00a4e4; }
|
||||
#menu .contests a:link, #menu .contests a:visited { color: #fff; text-decoration: none; font-weight: bold; }
|
||||
|
|
|
@ -60,15 +60,15 @@ body
|
|||
:margin 0
|
||||
input
|
||||
:margin 0 3px 0 0
|
||||
:padding: 2px
|
||||
:border: none
|
||||
:padding 2px
|
||||
:border none
|
||||
|
||||
#menu
|
||||
:clear both
|
||||
:text-align right
|
||||
:height 20px
|
||||
:border-bottom 5px solid #006b95
|
||||
:background: #00a4e4
|
||||
:background #00a4e4
|
||||
.contests
|
||||
ul
|
||||
:margin 0 5px 0 0
|
||||
|
|
Loading…
Reference in New Issue