sass 3.1.0.alpha.36 → 3.1.0.alpha.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/sass/engine.rb +13 -18
- data/lib/sass/scss/parser.rb +15 -5
- data/test/sass/engine_test.rb +6 -4
- data/test/sass/scss/scss_test.rb +16 -0
- metadata +1 -1
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0.alpha.
|
1
|
+
3.1.0.alpha.37
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0.alpha.
|
1
|
+
3.1.0.alpha.37
|
data/lib/sass/engine.rb
CHANGED
@@ -459,23 +459,21 @@ MSG
|
|
459
459
|
children.each do |line|
|
460
460
|
child = build_tree(parent, line, root)
|
461
461
|
|
462
|
-
if child.is_a?(Tree::RuleNode)
|
463
|
-
|
464
|
-
|
465
|
-
|
462
|
+
if child.is_a?(Tree::RuleNode)
|
463
|
+
if child.continued? && child.children.empty?
|
464
|
+
if continued_rule
|
465
|
+
continued_rule.add_rules child
|
466
|
+
else
|
467
|
+
continued_rule = child
|
468
|
+
end
|
469
|
+
next
|
470
|
+
elsif continued_rule
|
466
471
|
continued_rule.add_rules child
|
467
|
-
|
468
|
-
continued_rule =
|
472
|
+
continued_rule.children = child.children
|
473
|
+
continued_rule, child = nil, continued_rule
|
469
474
|
end
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
if continued_rule
|
474
|
-
raise SyntaxError.new("Rules can't end in commas.",
|
475
|
-
:line => continued_rule.line) unless child.is_a?(Tree::RuleNode)
|
476
|
-
continued_rule.add_rules child
|
477
|
-
continued_rule.children = child.children
|
478
|
-
continued_rule, child = nil, continued_rule
|
475
|
+
elsif continued_rule
|
476
|
+
continued_rule = nil
|
479
477
|
end
|
480
478
|
|
481
479
|
if child.is_a?(Tree::CommentNode) && child.silent
|
@@ -493,9 +491,6 @@ MSG
|
|
493
491
|
validate_and_append_child(parent, child, line, root)
|
494
492
|
end
|
495
493
|
|
496
|
-
raise SyntaxError.new("Rules can't end in commas.",
|
497
|
-
:line => continued_rule.line) if continued_rule
|
498
|
-
|
499
494
|
parent
|
500
495
|
end
|
501
496
|
|
data/lib/sass/scss/parser.rb
CHANGED
@@ -427,9 +427,14 @@ module Sass
|
|
427
427
|
return unless v = selector
|
428
428
|
rules.concat v
|
429
429
|
|
430
|
+
ws = ''
|
430
431
|
while tok(/,/)
|
431
|
-
|
432
|
-
|
432
|
+
ws << str {ss}
|
433
|
+
if v = selector
|
434
|
+
rules << ',' << ws
|
435
|
+
rules.concat v
|
436
|
+
ws = ''
|
437
|
+
end
|
433
438
|
end
|
434
439
|
rules
|
435
440
|
end
|
@@ -442,10 +447,14 @@ module Sass
|
|
442
447
|
def selector_comma_sequence
|
443
448
|
return unless sel = _selector
|
444
449
|
selectors = [sel]
|
450
|
+
ws = ''
|
445
451
|
while tok(/,/)
|
446
|
-
ws
|
447
|
-
|
448
|
-
|
452
|
+
ws << str{ss}
|
453
|
+
if sel = _selector
|
454
|
+
selectors << sel
|
455
|
+
selectors[-1] = Selector::Sequence.new(["\n"] + selectors.last.members) if ws.include?("\n")
|
456
|
+
ws = ''
|
457
|
+
end
|
449
458
|
end
|
450
459
|
Selector::CommaSequence.new(selectors)
|
451
460
|
end
|
@@ -790,6 +799,7 @@ MESSAGE
|
|
790
799
|
:interp_ident => "identifier",
|
791
800
|
:interp_name => "identifier",
|
792
801
|
:expr => "expression (e.g. 1px, bold)",
|
802
|
+
:_selector => "selector",
|
793
803
|
:selector_comma_sequence => "selector",
|
794
804
|
:simple_selector_sequence => "selector",
|
795
805
|
:import_arg => "file to import (string or url())",
|
data/test/sass/engine_test.rb
CHANGED
@@ -56,12 +56,8 @@ MSG
|
|
56
56
|
"$a: #ccc + 2px" => "Cannot add a number with units (2px) to a color (#cccccc).",
|
57
57
|
"& a\n :b c" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 1],
|
58
58
|
"a\n :b\n c" => "Illegal nesting: Only properties may be nested beneath properties.",
|
59
|
-
"a,\n :b c" => ["Rules can\'t end in commas.", 1],
|
60
|
-
"a," => "Rules can\'t end in commas.",
|
61
|
-
"a,\n$b: 1" => ["Rules can\'t end in commas.", 1],
|
62
59
|
"$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
|
63
60
|
"@import foo.sass" => "File to import not found or unreadable: foo.sass.",
|
64
|
-
"a,\n$b: 1" => ["Rules can\'t end in commas.", 1],
|
65
61
|
"$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
|
66
62
|
"@import foo.sass" => <<MSG,
|
67
63
|
File to import not found or unreadable: foo.sass.
|
@@ -610,6 +606,12 @@ SASS
|
|
610
606
|
|
611
607
|
assert_equal("#foo #bar,#baz #boom{foo:bar}\n",
|
612
608
|
render("#foo #bar,\n#baz #boom\n :foo bar", :style => :compressed))
|
609
|
+
|
610
|
+
assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n",
|
611
|
+
render("#foo #bar,,\n,#baz #boom,\n :foo bar"))
|
612
|
+
|
613
|
+
assert_equal("#bip #bop {\n foo: bar; }\n",
|
614
|
+
render("#bip #bop,, ,\n :foo bar"))
|
613
615
|
end
|
614
616
|
|
615
617
|
def test_complex_multiline_selector
|
data/test/sass/scss/scss_test.rb
CHANGED
@@ -468,6 +468,22 @@ baz {
|
|
468
468
|
SCSS
|
469
469
|
end
|
470
470
|
|
471
|
+
def test_trailing_comma_in_selector
|
472
|
+
assert_equal <<CSS, render(<<SCSS)
|
473
|
+
#foo #bar,
|
474
|
+
#baz #boom {
|
475
|
+
a: b; }
|
476
|
+
|
477
|
+
#bip #bop {
|
478
|
+
c: d; }
|
479
|
+
CSS
|
480
|
+
#foo #bar,,
|
481
|
+
,#baz #boom, {a: b}
|
482
|
+
|
483
|
+
#bip #bop, ,, {c: d}
|
484
|
+
SCSS
|
485
|
+
end
|
486
|
+
|
471
487
|
def test_parent_selectors
|
472
488
|
assert_equal <<CSS, render(<<SCSS)
|
473
489
|
foo:hover {
|