haml-edge 2.3.65 → 2.3.66
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/sass/css.rb +3 -1
- data/lib/sass/engine.rb +8 -4
- data/lib/sass/tree/prop_node.rb +13 -2
- data/lib/sass/tree/root_node.rb +5 -2
- data/test/sass/css2sass_test.rb +13 -0
- data/test/sass/engine_test.rb +34 -4
- metadata +2 -2
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.66
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.66
|
data/lib/sass/css.rb
CHANGED
@@ -24,7 +24,9 @@ module Sass
|
|
24
24
|
class RuleNode
|
25
25
|
# @see Node#to_sass
|
26
26
|
def to_sass(tabs, opts = {})
|
27
|
-
|
27
|
+
name = rules.first
|
28
|
+
name = "\\" + name if name[0] == ?:
|
29
|
+
str = "\n#{' ' * tabs}#{name}#{children.any? { |c| c.is_a? PropNode } ? "\n" : ''}"
|
28
30
|
|
29
31
|
children.each do |child|
|
30
32
|
str << "#{child.to_sass(tabs + 1, opts)}"
|
data/lib/sass/engine.rb
CHANGED
@@ -329,12 +329,16 @@ LONG
|
|
329
329
|
def parse_line(parent, line, root)
|
330
330
|
case line.text[0]
|
331
331
|
when PROPERTY_CHAR
|
332
|
-
if line.text[1]
|
333
|
-
|
334
|
-
|
332
|
+
if line.text[1] == PROPERTY_CHAR ||
|
333
|
+
(@options[:property_syntax] == :new &&
|
334
|
+
line.text =~ PROPERTY_OLD && $3.empty?)
|
335
335
|
# Support CSS3-style pseudo-elements,
|
336
|
-
# which begin with
|
336
|
+
# which begin with ::,
|
337
|
+
# as well as pseudo-classes
|
338
|
+
# if we're using the new property syntax
|
337
339
|
Tree::RuleNode.new(line.text)
|
340
|
+
else
|
341
|
+
parse_property(line, PROPERTY_OLD)
|
338
342
|
end
|
339
343
|
when Script::VARIABLE_CHAR
|
340
344
|
parse_variable(line)
|
data/lib/sass/tree/prop_node.rb
CHANGED
@@ -47,6 +47,16 @@ module Sass::Tree
|
|
47
47
|
self.class == other.class && name == other.name && value == other.value && super
|
48
48
|
end
|
49
49
|
|
50
|
+
# Returns a appropriate message indicating how to escape pseudo-class selectors.
|
51
|
+
# This only applies for old-style properties with no value,
|
52
|
+
# so returns the empty string if this is new-style.
|
53
|
+
#
|
54
|
+
# @return [String] The message
|
55
|
+
def pseudo_class_selector_message
|
56
|
+
return "" if @prop_syntax == :new || !value.empty?
|
57
|
+
"\nIf #{declaration.dump} should be a selector, use \"\\#{declaration}\" instead."
|
58
|
+
end
|
59
|
+
|
50
60
|
protected
|
51
61
|
|
52
62
|
# Computes the CSS for the property.
|
@@ -62,7 +72,8 @@ module Sass::Tree
|
|
62
72
|
elsif value[-1] == ?;
|
63
73
|
raise Sass::SyntaxError.new("Invalid property: #{declaration.dump} (no \";\" required at end-of-line).")
|
64
74
|
elsif value.empty?
|
65
|
-
raise Sass::SyntaxError.new("Invalid property: #{declaration.dump} (no value)."
|
75
|
+
raise Sass::SyntaxError.new("Invalid property: #{declaration.dump} (no value)." +
|
76
|
+
pseudo_class_selector_message)
|
66
77
|
end
|
67
78
|
|
68
79
|
to_return = ' ' * (tabs - 1 + indentation) + name + ":" +
|
@@ -112,7 +123,7 @@ module Sass::Tree
|
|
112
123
|
private
|
113
124
|
|
114
125
|
def declaration
|
115
|
-
@prop_syntax == :new ? "#{name}: #{value}" : ":#{name} #{value}"
|
126
|
+
(@prop_syntax == :new ? "#{name}: #{value}" : ":#{name} #{value}").strip
|
116
127
|
end
|
117
128
|
end
|
118
129
|
end
|
data/lib/sass/tree/root_node.rb
CHANGED
@@ -40,8 +40,11 @@ module Sass
|
|
40
40
|
def _to_s(*args)
|
41
41
|
result = String.new
|
42
42
|
children.each do |child|
|
43
|
-
|
44
|
-
|
43
|
+
if child.is_a? PropNode
|
44
|
+
message = "Properties aren't allowed at the root of a document." +
|
45
|
+
child.pseudo_class_selector_message
|
46
|
+
raise Sass::SyntaxError.new(message, :line => child.line)
|
47
|
+
end
|
45
48
|
|
46
49
|
next if child.invisible?
|
47
50
|
child_str = child.to_s(1)
|
data/test/sass/css2sass_test.rb
CHANGED
@@ -230,6 +230,19 @@ SASS
|
|
230
230
|
CSS
|
231
231
|
end
|
232
232
|
|
233
|
+
def test_pseudo_classes_are_escaped
|
234
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
235
|
+
\\:focus
|
236
|
+
a: b
|
237
|
+
|
238
|
+
\\:foo
|
239
|
+
bar: baz
|
240
|
+
SASS
|
241
|
+
:focus {a: b;}
|
242
|
+
:focus :foo {bar: baz;}
|
243
|
+
CSS
|
244
|
+
end
|
245
|
+
|
233
246
|
# Error reporting
|
234
247
|
|
235
248
|
def test_error_reporting
|
data/test/sass/engine_test.rb
CHANGED
@@ -18,8 +18,11 @@ class SassEngineTest < Test::Unit::TestCase
|
|
18
18
|
":" => 'Invalid property: ":".',
|
19
19
|
": a" => 'Invalid property: ": a".',
|
20
20
|
":= a" => 'Invalid property: ":= a".',
|
21
|
-
"a\n :b" =>
|
22
|
-
|
21
|
+
"a\n :b" => <<MSG,
|
22
|
+
Invalid property: ":b" (no value).
|
23
|
+
If ":b" should be a selector, use "\\:b" instead.
|
24
|
+
MSG
|
25
|
+
"a\n b:" => 'Invalid property: "b:" (no value).',
|
23
26
|
"a\n :b: c" => 'Invalid property: ":b: c".',
|
24
27
|
"a\n :b:c d" => 'Invalid property: ":b:c d".',
|
25
28
|
"a\n :b=c d" => 'Invalid property: ":b=c d".',
|
@@ -28,6 +31,12 @@ class SassEngineTest < Test::Unit::TestCase
|
|
28
31
|
"a\n b : c" => 'Invalid property: "b : c".',
|
29
32
|
"a\n b=c: d" => 'Invalid property: "b=c: d".',
|
30
33
|
"a: b" => 'Properties aren\'t allowed at the root of a document.',
|
34
|
+
":a b" => 'Properties aren\'t allowed at the root of a document.',
|
35
|
+
"a:" => 'Properties aren\'t allowed at the root of a document.',
|
36
|
+
":a" => <<MSG,
|
37
|
+
Properties aren't allowed at the root of a document.
|
38
|
+
If ":a" should be a selector, use "\\:a" instead.
|
39
|
+
MSG
|
31
40
|
"!" => 'Invalid variable: "!".',
|
32
41
|
"!a" => 'Invalid variable: "!a".',
|
33
42
|
"! a" => 'Invalid variable: "! a".',
|
@@ -134,7 +143,7 @@ class SassEngineTest < Test::Unit::TestCase
|
|
134
143
|
rescue Sass::SyntaxError => err
|
135
144
|
value = [value] unless value.is_a?(Array)
|
136
145
|
|
137
|
-
assert_equal(value.first, err.message, "Line: #{key}")
|
146
|
+
assert_equal(value.first.rstrip, err.message, "Line: #{key}")
|
138
147
|
assert_equal(__FILE__, err.sass_filename)
|
139
148
|
assert_equal((value[1] || key.split("\n").length) + line - 1, err.sass_line, "Line: #{key}")
|
140
149
|
assert_match(/#{Regexp.escape(__FILE__)}:[0-9]+/, err.backtrace[0], "Line: #{key}")
|
@@ -233,7 +242,7 @@ SASS
|
|
233
242
|
rescue Sass::SyntaxError => e
|
234
243
|
assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e, opts).split("\n")[0..15].join("\n"))
|
235
244
|
/*
|
236
|
-
Syntax error: Invalid property: "e:
|
245
|
+
Syntax error: Invalid property: "e:" (no value).
|
237
246
|
on line 383 of test_exception_css_with_offset_inline.sass
|
238
247
|
|
239
248
|
378: a
|
@@ -822,6 +831,27 @@ bang, bip, bop
|
|
822
831
|
SASS
|
823
832
|
end
|
824
833
|
|
834
|
+
def test_root_level_pseudo_class_with_new_properties
|
835
|
+
assert_equal(<<CSS, render(<<SASS, :property_syntax => :new))
|
836
|
+
:focus {
|
837
|
+
outline: 0; }
|
838
|
+
CSS
|
839
|
+
:focus
|
840
|
+
outline: 0
|
841
|
+
SASS
|
842
|
+
end
|
843
|
+
|
844
|
+
def test_pseudo_class_with_new_properties
|
845
|
+
assert_equal(<<CSS, render(<<SASS, :property_syntax => :new))
|
846
|
+
p :focus {
|
847
|
+
outline: 0; }
|
848
|
+
CSS
|
849
|
+
p
|
850
|
+
:focus
|
851
|
+
outline: 0
|
852
|
+
SASS
|
853
|
+
end
|
854
|
+
|
825
855
|
# Regression tests
|
826
856
|
|
827
857
|
def test_parens_in_mixins
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml-edge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.66
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Weizenbaum
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-10-
|
13
|
+
date: 2009-10-31 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|