sass 3.5.2 → 3.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODE_OF_CONDUCT.md +1 -1
- data/CONTRIBUTING.md +3 -3
- data/README.md +17 -9
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/extra/sass-spec-ref.sh +9 -1
- data/lib/sass/engine.rb +1 -9
- data/lib/sass/exec/base.rb +0 -2
- data/lib/sass/exec/sass_scss.rb +1 -5
- data/lib/sass/importers/filesystem.rb +4 -2
- data/lib/sass/logger/base.rb +11 -0
- data/lib/sass/script/css_parser.rb +4 -1
- data/lib/sass/script/functions.rb +76 -41
- data/lib/sass/script/lexer.rb +62 -19
- data/lib/sass/script/parser.rb +260 -93
- data/lib/sass/script/tree/funcall.rb +0 -4
- data/lib/sass/script/tree/interpolation.rb +0 -3
- data/lib/sass/script/tree/operation.rb +1 -1
- data/lib/sass/script/value/color.rb +3 -2
- data/lib/sass/script/value/helpers.rb +8 -2
- data/lib/sass/script/value/number.rb +2 -1
- data/lib/sass/scss/css_parser.rb +6 -1
- data/lib/sass/scss/parser.rb +48 -18
- data/lib/sass/scss/rx.rb +1 -1
- data/lib/sass/scss/static_parser.rb +15 -18
- data/lib/sass/selector/comma_sequence.rb +2 -1
- data/lib/sass/selector/pseudo.rb +1 -1
- data/lib/sass/selector/sequence.rb +0 -4
- data/lib/sass/source/map.rb +0 -4
- data/lib/sass/tree/rule_node.rb +3 -6
- data/lib/sass/tree/visitors/perform.rb +2 -6
- data/lib/sass/tree/visitors/to_css.rb +4 -11
- data/lib/sass/util.rb +60 -20
- data/lib/sass/version.rb +0 -2
- metadata +38 -162
- data/Rakefile +0 -338
- data/lib/test.css +0 -4
- data/lib/test.css.map +0 -7
- data/test/sass-spec.yml +0 -3
- data/test/sass/cache_test.rb +0 -130
- data/test/sass/callbacks_test.rb +0 -60
- data/test/sass/compiler_test.rb +0 -225
- data/test/sass/conversion_test.rb +0 -2138
- data/test/sass/css2sass_test.rb +0 -523
- data/test/sass/css_variable_test.rb +0 -237
- data/test/sass/data/hsl-rgb.txt +0 -319
- data/test/sass/encoding_test.rb +0 -188
- data/test/sass/engine_test.rb +0 -3499
- data/test/sass/exec_test.rb +0 -95
- data/test/sass/extend_test.rb +0 -1678
- data/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
- data/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
- data/test/sass/functions_test.rb +0 -2021
- data/test/sass/importer_test.rb +0 -420
- data/test/sass/logger_test.rb +0 -57
- data/test/sass/mock_importer.rb +0 -49
- data/test/sass/more_results/more1.css +0 -9
- data/test/sass/more_results/more1_with_line_comments.css +0 -26
- data/test/sass/more_results/more_import.css +0 -29
- data/test/sass/more_templates/_more_partial.sass +0 -2
- data/test/sass/more_templates/more1.sass +0 -23
- data/test/sass/more_templates/more_import.sass +0 -11
- data/test/sass/plugin_test.rb +0 -552
- data/test/sass/results/alt.css +0 -4
- data/test/sass/results/basic.css +0 -9
- data/test/sass/results/cached_import_option.css +0 -3
- data/test/sass/results/compact.css +0 -5
- data/test/sass/results/complex.css +0 -86
- data/test/sass/results/compressed.css +0 -1
- data/test/sass/results/expanded.css +0 -19
- data/test/sass/results/filename_fn.css +0 -3
- data/test/sass/results/if.css +0 -3
- data/test/sass/results/import.css +0 -31
- data/test/sass/results/import_charset.css +0 -5
- data/test/sass/results/import_charset_ibm866.css +0 -5
- data/test/sass/results/import_content.css +0 -1
- data/test/sass/results/line_numbers.css +0 -49
- data/test/sass/results/mixins.css +0 -95
- data/test/sass/results/multiline.css +0 -24
- data/test/sass/results/nested.css +0 -22
- data/test/sass/results/options.css +0 -1
- data/test/sass/results/parent_ref.css +0 -13
- data/test/sass/results/script.css +0 -16
- data/test/sass/results/scss_import.css +0 -31
- data/test/sass/results/scss_importee.css +0 -2
- data/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
- data/test/sass/results/subdir/subdir.css +0 -3
- data/test/sass/results/units.css +0 -11
- data/test/sass/results/warn.css +0 -0
- data/test/sass/results/warn_imported.css +0 -0
- data/test/sass/script_conversion_test.rb +0 -365
- data/test/sass/script_test.rb +0 -1429
- data/test/sass/scss/css_test.rb +0 -1266
- data/test/sass/scss/rx_test.rb +0 -159
- data/test/sass/scss/scss_test.rb +0 -4238
- data/test/sass/scss/test_helper.rb +0 -37
- data/test/sass/source_map_test.rb +0 -1052
- data/test/sass/superselector_test.rb +0 -209
- data/test/sass/templates/_cached_import_option_partial.scss +0 -1
- data/test/sass/templates/_double_import_loop2.sass +0 -1
- data/test/sass/templates/_filename_fn_import.scss +0 -11
- data/test/sass/templates/_imported_charset_ibm866.sass +0 -4
- data/test/sass/templates/_imported_charset_utf8.sass +0 -4
- data/test/sass/templates/_imported_content.sass +0 -3
- data/test/sass/templates/_partial.sass +0 -2
- data/test/sass/templates/_same_name_different_partiality.scss +0 -1
- data/test/sass/templates/alt.sass +0 -16
- data/test/sass/templates/basic.sass +0 -23
- data/test/sass/templates/bork1.sass +0 -2
- data/test/sass/templates/bork2.sass +0 -2
- data/test/sass/templates/bork3.sass +0 -2
- data/test/sass/templates/bork4.sass +0 -2
- data/test/sass/templates/bork5.sass +0 -3
- data/test/sass/templates/cached_import_option.scss +0 -3
- data/test/sass/templates/compact.sass +0 -17
- data/test/sass/templates/complex.sass +0 -305
- data/test/sass/templates/compressed.sass +0 -15
- data/test/sass/templates/double_import_loop1.sass +0 -1
- data/test/sass/templates/expanded.sass +0 -17
- data/test/sass/templates/filename_fn.scss +0 -18
- data/test/sass/templates/if.sass +0 -11
- data/test/sass/templates/import.sass +0 -12
- data/test/sass/templates/import_charset.sass +0 -9
- data/test/sass/templates/import_charset_ibm866.sass +0 -11
- data/test/sass/templates/import_content.sass +0 -4
- data/test/sass/templates/importee.less +0 -2
- data/test/sass/templates/importee.sass +0 -19
- data/test/sass/templates/line_numbers.sass +0 -13
- data/test/sass/templates/mixin_bork.sass +0 -5
- data/test/sass/templates/mixins.sass +0 -76
- data/test/sass/templates/multiline.sass +0 -20
- data/test/sass/templates/nested.sass +0 -25
- data/test/sass/templates/nested_bork1.sass +0 -2
- data/test/sass/templates/nested_bork2.sass +0 -2
- data/test/sass/templates/nested_bork3.sass +0 -2
- data/test/sass/templates/nested_bork4.sass +0 -2
- data/test/sass/templates/nested_import.sass +0 -2
- data/test/sass/templates/nested_mixin_bork.sass +0 -6
- data/test/sass/templates/options.sass +0 -2
- data/test/sass/templates/parent_ref.sass +0 -25
- data/test/sass/templates/same_name_different_ext.sass +0 -2
- data/test/sass/templates/same_name_different_ext.scss +0 -1
- data/test/sass/templates/same_name_different_partiality.scss +0 -1
- data/test/sass/templates/script.sass +0 -101
- data/test/sass/templates/scss_import.scss +0 -12
- data/test/sass/templates/scss_importee.scss +0 -1
- data/test/sass/templates/single_import_loop.sass +0 -1
- data/test/sass/templates/subdir/import_up1.scss +0 -1
- data/test/sass/templates/subdir/import_up2.scss +0 -1
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
- data/test/sass/templates/subdir/subdir.sass +0 -6
- data/test/sass/templates/units.sass +0 -11
- data/test/sass/templates/warn.sass +0 -3
- data/test/sass/templates/warn_imported.sass +0 -4
- data/test/sass/test_helper.rb +0 -8
- data/test/sass/util/multibyte_string_scanner_test.rb +0 -152
- data/test/sass/util/normalized_map_test.rb +0 -50
- data/test/sass/util/subset_map_test.rb +0 -90
- data/test/sass/util_test.rb +0 -403
- data/test/sass/value_helpers_test.rb +0 -178
- data/test/test_helper.rb +0 -149
@@ -68,13 +68,11 @@ module Sass::Script::Tree
|
|
68
68
|
def inspect
|
69
69
|
args = @args.map {|a| a.inspect}.join(', ')
|
70
70
|
keywords = @keywords.as_stored.to_a.map {|k, v| "$#{k}: #{v.inspect}"}.join(', ')
|
71
|
-
# rubocop:disable RedundantSelf
|
72
71
|
if self.splat
|
73
72
|
splat = args.empty? && keywords.empty? ? "" : ", "
|
74
73
|
splat = "#{splat}#{self.splat.inspect}..."
|
75
74
|
splat = "#{splat}, #{kwarg_splat.inspect}..." if kwarg_splat
|
76
75
|
end
|
77
|
-
# rubocop:enable RedundantSelf
|
78
76
|
"#{name}(#{args}#{', ' unless args.empty? || keywords.empty?}#{keywords}#{splat})"
|
79
77
|
end
|
80
78
|
|
@@ -89,12 +87,10 @@ module Sass::Script::Tree
|
|
89
87
|
args = @args.map(&arg_to_sass)
|
90
88
|
keywords = @keywords.as_stored.to_a.map {|k, v| "$#{dasherize(k, opts)}: #{arg_to_sass[v]}"}
|
91
89
|
|
92
|
-
# rubocop:disable RedundantSelf
|
93
90
|
if self.splat
|
94
91
|
splat = "#{arg_to_sass[self.splat]}..."
|
95
92
|
kwarg_splat = "#{arg_to_sass[self.kwarg_splat]}..." if self.kwarg_splat
|
96
93
|
end
|
97
|
-
# rubocop:enable RedundantSelf
|
98
94
|
|
99
95
|
arglist = [args, splat, keywords, kwarg_splat].flatten.compact.join(', ')
|
100
96
|
"#{dasherize(name, opts)}(#{arglist})"
|
@@ -47,10 +47,7 @@ module Sass::Script::Tree
|
|
47
47
|
# @param wa [Boolean] See {Interpolation#whitespace_after}
|
48
48
|
# @param originally_text [Boolean] See {Interpolation#originally_text}
|
49
49
|
# @param warn_for_color [Boolean] See {Interpolation#warn_for_color}
|
50
|
-
# @comment
|
51
|
-
# rubocop:disable ParameterLists
|
52
50
|
def initialize(before, mid, after, wb, wa, opts = {})
|
53
|
-
# rubocop:enable ParameterLists
|
54
51
|
@before = before
|
55
52
|
@mid = mid
|
56
53
|
@after = after
|
@@ -111,7 +111,7 @@ module Sass::Script::Tree
|
|
111
111
|
@@color_arithmetic_deprecation.warn(filename, line, <<WARNING)
|
112
112
|
The operation `#{value1} #{@operator} #{value2}` is deprecated and will be an error in future versions.
|
113
113
|
Consider using Sass's color functions instead.
|
114
|
-
|
114
|
+
https://sass-lang.com/documentation/Sass/Script/Functions.html#other_color_functions
|
115
115
|
WARNING
|
116
116
|
end
|
117
117
|
|
@@ -277,13 +277,14 @@ module Sass::Script::Value
|
|
277
277
|
#
|
278
278
|
# @return [Color]
|
279
279
|
def self.from_hex(hex_string, alpha = nil)
|
280
|
-
unless hex_string =~ /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})
|
281
|
-
hex_string =~ /^#?([0-9a-f])([0-9a-f])([0-9a-f])
|
280
|
+
unless hex_string =~ /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i ||
|
281
|
+
hex_string =~ /^#?([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i
|
282
282
|
raise ArgumentError.new("#{hex_string.inspect} is not a valid hex color.")
|
283
283
|
end
|
284
284
|
red = $1.ljust(2, $1).to_i(16)
|
285
285
|
green = $2.ljust(2, $2).to_i(16)
|
286
286
|
blue = $3.ljust(2, $3).to_i(16)
|
287
|
+
alpha = $4.ljust(2, $4).to_i(16).to_f / 0xff if $4
|
287
288
|
|
288
289
|
hex_string = "##{hex_string}" unless hex_string[0] == ?#
|
289
290
|
attrs = {:red => red, :green => green, :blue => blue, :representation => hex_string}
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module Sass::Script::Value
|
2
2
|
# Provides helper functions for creating sass values from within ruby methods.
|
3
3
|
# @since `3.3.0`
|
4
|
-
# @comment
|
5
|
-
# rubocop:disable ModuleLength
|
6
4
|
module Helpers
|
7
5
|
# Construct a Sass Boolean.
|
8
6
|
#
|
@@ -215,6 +213,14 @@ module Sass::Script::Value
|
|
215
213
|
literal.is_a?(Sass::Script::Value::String) && literal.value =~ /calc\(/
|
216
214
|
end
|
217
215
|
|
216
|
+
# Returns true when the literal is a string containing a var().
|
217
|
+
#
|
218
|
+
# @param literal [Sass::Script::Value::Base] The value to check
|
219
|
+
# @return Boolean
|
220
|
+
def var?(literal)
|
221
|
+
literal.is_a?(Sass::Script::Value::String) && literal.value =~ /var\(/
|
222
|
+
end
|
223
|
+
|
218
224
|
# Returns whether the literal is a special CSS value that may evaluate to a
|
219
225
|
# number, such as `calc()` or `var()`.
|
220
226
|
#
|
@@ -189,6 +189,7 @@ module Sass::Script::Value
|
|
189
189
|
# @raise [Sass::UnitConversionError] if `other` has incompatible units
|
190
190
|
def mod(other)
|
191
191
|
if other.is_a?(Number)
|
192
|
+
return Number.new(Float::NAN) if other.value == 0
|
192
193
|
operate(other, :%)
|
193
194
|
else
|
194
195
|
raise NoMethodError.new(nil, :mod)
|
@@ -472,7 +473,7 @@ module Sass::Script::Value
|
|
472
473
|
sans_common_units(@numerator_units, @denominator_units)
|
473
474
|
|
474
475
|
@denominator_units.each_with_index do |d, i|
|
475
|
-
next unless convertable?(d) && (u = @numerator_units.find
|
476
|
+
next unless convertable?(d) && (u = @numerator_units.find {|n| convertable?([n, d])})
|
476
477
|
@value /= conversion_factor(d, u)
|
477
478
|
@denominator_units.delete_at(i)
|
478
479
|
@numerator_units.delete_at(@numerator_units.index(u))
|
data/lib/sass/scss/css_parser.rb
CHANGED
@@ -47,7 +47,12 @@ module Sass
|
|
47
47
|
def keyframes_ruleset
|
48
48
|
start_pos = source_position
|
49
49
|
return unless (selector = keyframes_selector)
|
50
|
-
block(
|
50
|
+
block(
|
51
|
+
node(
|
52
|
+
Sass::Tree::KeyframeRuleNode.new(
|
53
|
+
Sass::Util.strip_except_escapes(selector)),
|
54
|
+
start_pos),
|
55
|
+
:ruleset)
|
51
56
|
end
|
52
57
|
|
53
58
|
@sass_script_parser = Sass::Script::CssParser
|
data/lib/sass/scss/parser.rb
CHANGED
@@ -203,7 +203,7 @@ module Sass
|
|
203
203
|
def directive
|
204
204
|
start_pos = source_position
|
205
205
|
return unless tok(/@/)
|
206
|
-
name =
|
206
|
+
name = ident!
|
207
207
|
ss
|
208
208
|
|
209
209
|
if (dir = special_directive(name, start_pos))
|
@@ -240,14 +240,14 @@ module Sass
|
|
240
240
|
end
|
241
241
|
|
242
242
|
def mixin_directive(start_pos)
|
243
|
-
name =
|
243
|
+
name = ident!
|
244
244
|
args, splat = sass_script(:parse_mixin_definition_arglist)
|
245
245
|
ss
|
246
246
|
block(node(Sass::Tree::MixinDefNode.new(name, args, splat), start_pos), :directive)
|
247
247
|
end
|
248
248
|
|
249
249
|
def include_directive(start_pos)
|
250
|
-
name =
|
250
|
+
name = ident!
|
251
251
|
args, keywords, splat, kwarg_splat = sass_script(:parse_mixin_include_arglist)
|
252
252
|
ss
|
253
253
|
include_node = node(
|
@@ -266,7 +266,7 @@ module Sass
|
|
266
266
|
end
|
267
267
|
|
268
268
|
def function_directive(start_pos)
|
269
|
-
name =
|
269
|
+
name = ident!
|
270
270
|
args, splat = sass_script(:parse_function_definition_arglist)
|
271
271
|
ss
|
272
272
|
block(node(Sass::Tree::FunctionNode.new(name, args, splat), start_pos), :function)
|
@@ -286,7 +286,7 @@ module Sass
|
|
286
286
|
|
287
287
|
def for_directive(start_pos)
|
288
288
|
tok!(/\$/)
|
289
|
-
var =
|
289
|
+
var = ident!
|
290
290
|
ss
|
291
291
|
|
292
292
|
tok!(/from/)
|
@@ -303,12 +303,12 @@ module Sass
|
|
303
303
|
|
304
304
|
def each_directive(start_pos)
|
305
305
|
tok!(/\$/)
|
306
|
-
vars = [
|
306
|
+
vars = [ident!]
|
307
307
|
ss
|
308
308
|
while tok(/,/)
|
309
309
|
ss
|
310
310
|
tok!(/\$/)
|
311
|
-
vars <<
|
311
|
+
vars << ident!
|
312
312
|
ss
|
313
313
|
end
|
314
314
|
|
@@ -477,12 +477,23 @@ module Sass
|
|
477
477
|
return unless tok(/\(/)
|
478
478
|
res = ['(']
|
479
479
|
ss
|
480
|
-
|
480
|
+
stop_at = Set[:single_eq, :lt, :lte, :gt, :gte]
|
481
|
+
res << sass_script(:parse_until, stop_at)
|
481
482
|
|
482
483
|
if tok(/:/)
|
483
484
|
res << ': '
|
484
485
|
ss
|
485
486
|
res << sass_script(:parse)
|
487
|
+
elsif comparison1 = tok(/=|[<>]=?/)
|
488
|
+
res << ' ' << comparison1 << ' '
|
489
|
+
ss
|
490
|
+
res << sass_script(:parse_until, stop_at)
|
491
|
+
if ((comparison1 == ">" || comparison1 == ">=") && comparison2 = tok(/>=?/)) ||
|
492
|
+
((comparison1 == "<" || comparison1 == "<=") && comparison2 = tok(/<=?/))
|
493
|
+
res << ' ' << comparison2 << ' '
|
494
|
+
ss
|
495
|
+
res << sass_script(:parse_until, stop_at)
|
496
|
+
end
|
486
497
|
end
|
487
498
|
res << tok!(/\)/)
|
488
499
|
ss
|
@@ -542,10 +553,10 @@ module Sass
|
|
542
553
|
end
|
543
554
|
|
544
555
|
def at_root_directive_list
|
545
|
-
return unless (first =
|
556
|
+
return unless (first = ident)
|
546
557
|
arr = [first]
|
547
558
|
ss
|
548
|
-
while (e =
|
559
|
+
while (e = ident)
|
549
560
|
arr << e
|
550
561
|
ss
|
551
562
|
end
|
@@ -636,12 +647,12 @@ module Sass
|
|
636
647
|
def variable
|
637
648
|
return unless tok(/\$/)
|
638
649
|
start_pos = source_position
|
639
|
-
name =
|
650
|
+
name = ident!
|
640
651
|
ss; tok!(/:/); ss
|
641
652
|
|
642
653
|
expr = sass_script(:parse)
|
643
654
|
while tok(/!/)
|
644
|
-
flag_name =
|
655
|
+
flag_name = ident!
|
645
656
|
if flag_name == 'default'
|
646
657
|
guarded ||= true
|
647
658
|
elsif flag_name == 'global'
|
@@ -898,7 +909,7 @@ module Sass
|
|
898
909
|
(?!
|
899
910
|
url\(
|
900
911
|
)
|
901
|
-
[^()\[\]{}"'#/ \t\r\n\f#{top_level ? "
|
912
|
+
[^()\[\]{}"'#/ \t\r\n\f#{top_level ? ";" : ""}]
|
902
913
|
|
|
903
914
|
\#(?!\{)
|
904
915
|
|
|
@@ -980,7 +991,10 @@ module Sass
|
|
980
991
|
# containing the value.
|
981
992
|
# This results in a dramatic speed increase.
|
982
993
|
if (val = tok(STATIC_VALUE))
|
983
|
-
|
994
|
+
# If val ends with escaped whitespace, leave it be.
|
995
|
+
str = Sass::Script::Tree::Literal.new(
|
996
|
+
Sass::Script::Value::String.new(
|
997
|
+
Sass::Util.strip_except_escapes(val)))
|
984
998
|
str.line = start_pos.line
|
985
999
|
str.source_range = range(start_pos)
|
986
1000
|
return str
|
@@ -1037,7 +1051,7 @@ module Sass
|
|
1037
1051
|
def var_expr
|
1038
1052
|
return unless tok(/\$/)
|
1039
1053
|
line = @line
|
1040
|
-
var = Sass::Script::Tree::Variable.new(
|
1054
|
+
var = Sass::Script::Tree::Variable.new(ident!)
|
1041
1055
|
var.line = line
|
1042
1056
|
var
|
1043
1057
|
end
|
@@ -1075,11 +1089,27 @@ module Sass
|
|
1075
1089
|
res
|
1076
1090
|
end
|
1077
1091
|
|
1078
|
-
def
|
1079
|
-
|
1092
|
+
def ident
|
1093
|
+
(ident = tok(IDENT)) && Sass::Util.normalize_ident_escapes(ident)
|
1094
|
+
end
|
1095
|
+
|
1096
|
+
def ident!
|
1097
|
+
Sass::Util.normalize_ident_escapes(tok!(IDENT))
|
1098
|
+
end
|
1099
|
+
|
1100
|
+
def name
|
1101
|
+
(name = tok(NAME)) && Sass::Util.normalize_ident_escapes(name)
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
def name!
|
1105
|
+
Sass::Util.normalize_ident_escapes(tok!(NAME))
|
1106
|
+
end
|
1107
|
+
|
1108
|
+
def interp_ident
|
1109
|
+
val = ident || interpolation(:warn_for_color) || tok(IDENT_HYPHEN_INTERP)
|
1080
1110
|
return unless val
|
1081
1111
|
res = [val]
|
1082
|
-
while (val =
|
1112
|
+
while (val = name || interpolation(:warn_for_color))
|
1083
1113
|
res << val
|
1084
1114
|
end
|
1085
1115
|
res
|
data/lib/sass/scss/rx.rb
CHANGED
@@ -52,7 +52,7 @@ module Sass
|
|
52
52
|
UNICODE = /\\#{H}{1,6}[ \t\r\n\f]?/
|
53
53
|
s = '\u{80}-\u{D7FF}\u{E000}-\u{FFFD}\u{10000}-\u{10FFFF}'
|
54
54
|
NONASCII = /[#{s}]/
|
55
|
-
ESCAPE = /#{UNICODE}|\\[
|
55
|
+
ESCAPE = /#{UNICODE}|\\[^0-9a-fA-F\r\n\f]/
|
56
56
|
NMSTART = /[_a-zA-Z]|#{NONASCII}|#{ESCAPE}/
|
57
57
|
NMCHAR = /[a-zA-Z0-9_-]|#{NONASCII}|#{ESCAPE}/
|
58
58
|
STRING1 = /\"((?:[^\n\r\f\\"]|\\#{NL}|#{ESCAPE})*)\"/
|
@@ -51,10 +51,7 @@ module Sass
|
|
51
51
|
# @see Parser#initialize
|
52
52
|
# @param allow_parent_ref [Boolean] Whether to allow the
|
53
53
|
# parent-reference selector, `&`, when parsing the document.
|
54
|
-
# @comment
|
55
|
-
# rubocop:disable ParameterLists
|
56
54
|
def initialize(str, filename, importer, line = 1, offset = 1, allow_parent_ref = true)
|
57
|
-
# rubocop:enable ParameterLists
|
58
55
|
super(str, filename, importer, line, offset)
|
59
56
|
@allow_parent_ref = allow_parent_ref
|
60
57
|
end
|
@@ -74,7 +71,7 @@ module Sass
|
|
74
71
|
def var_expr; nil; end
|
75
72
|
def interp_string; (s = tok(STRING)) && [s]; end
|
76
73
|
def interp_uri; (s = tok(URI)) && [s]; end
|
77
|
-
def interp_ident
|
74
|
+
def interp_ident; (s = ident) && [s]; end
|
78
75
|
def use_css_import?; true; end
|
79
76
|
|
80
77
|
def special_directive(name, start_pos)
|
@@ -188,25 +185,25 @@ MESSAGE
|
|
188
185
|
|
189
186
|
def parent_selector
|
190
187
|
return unless @allow_parent_ref && tok(/&/)
|
191
|
-
Selector::Parent.new(
|
188
|
+
Selector::Parent.new(name)
|
192
189
|
end
|
193
190
|
|
194
191
|
def class_selector
|
195
192
|
return unless tok(/\./)
|
196
193
|
@expected = "class name"
|
197
|
-
Selector::Class.new(
|
194
|
+
Selector::Class.new(ident!)
|
198
195
|
end
|
199
196
|
|
200
197
|
def id_selector
|
201
198
|
return unless tok(/#(?!\{)/)
|
202
199
|
@expected = "id name"
|
203
|
-
Selector::Id.new(
|
200
|
+
Selector::Id.new(name!)
|
204
201
|
end
|
205
202
|
|
206
203
|
def placeholder_selector
|
207
204
|
return unless tok(/%/)
|
208
205
|
@expected = "placeholder name"
|
209
|
-
Selector::Placeholder.new(
|
206
|
+
Selector::Placeholder.new(ident!)
|
210
207
|
end
|
211
208
|
|
212
209
|
def element_name
|
@@ -221,13 +218,13 @@ MESSAGE
|
|
221
218
|
end
|
222
219
|
|
223
220
|
def qualified_name(allow_star_name = false)
|
224
|
-
name =
|
221
|
+
name = ident || tok(/\*/) || (tok?(/\|/) && "")
|
225
222
|
return unless name
|
226
223
|
return nil, name unless tok(/\|/)
|
227
224
|
|
228
|
-
return name,
|
225
|
+
return name, ident! unless allow_star_name
|
229
226
|
@expected = "identifier or *"
|
230
|
-
return name,
|
227
|
+
return name, ident || tok!(/\*/)
|
231
228
|
end
|
232
229
|
|
233
230
|
def attrib
|
@@ -245,21 +242,21 @@ MESSAGE
|
|
245
242
|
if op
|
246
243
|
@expected = "identifier or string"
|
247
244
|
ss
|
248
|
-
val =
|
245
|
+
val = ident || tok!(STRING)
|
249
246
|
ss
|
250
247
|
end
|
251
|
-
flags =
|
248
|
+
flags = ident || tok(STRING)
|
252
249
|
tok!(/\]/)
|
253
250
|
|
254
251
|
Selector::Attribute.new(name, ns, op, val, flags)
|
255
252
|
end
|
256
253
|
|
257
254
|
def attrib_name!
|
258
|
-
if (name_or_ns =
|
255
|
+
if (name_or_ns = ident)
|
259
256
|
# E, E|E
|
260
257
|
if tok(/\|(?!=)/)
|
261
258
|
ns = name_or_ns
|
262
|
-
name =
|
259
|
+
name = ident
|
263
260
|
else
|
264
261
|
name = name_or_ns
|
265
262
|
end
|
@@ -267,7 +264,7 @@ MESSAGE
|
|
267
264
|
# *|E or |E
|
268
265
|
ns = tok(/\*/) || ""
|
269
266
|
tok!(/\|/)
|
270
|
-
name =
|
267
|
+
name = ident!
|
271
268
|
end
|
272
269
|
return ns, name
|
273
270
|
end
|
@@ -282,7 +279,7 @@ MESSAGE
|
|
282
279
|
s = tok(/::?/)
|
283
280
|
return unless s
|
284
281
|
@expected = "pseudoclass or pseudoelement"
|
285
|
-
name =
|
282
|
+
name = ident!
|
286
283
|
if tok(/\(/)
|
287
284
|
ss
|
288
285
|
deprefixed = deprefix(name)
|
@@ -345,7 +342,7 @@ MESSAGE
|
|
345
342
|
end
|
346
343
|
|
347
344
|
def keyframes_selector_component
|
348
|
-
|
345
|
+
ident || tok(PERCENTAGE)
|
349
346
|
end
|
350
347
|
|
351
348
|
@sass_script_parser = Class.new(Sass::Script::CssParser)
|
@@ -119,7 +119,8 @@ module Sass
|
|
119
119
|
if !allow_compound_target && sel.length > 1
|
120
120
|
@@compound_extend_deprecation.warn(sseq.filename, sseq.line, <<WARNING)
|
121
121
|
Extending a compound selector, #{sseq}, is deprecated and will not be supported in a future release.
|
122
|
-
|
122
|
+
Consider "@extend #{sseq.members.join(', ')}" instead.
|
123
|
+
See http://bit.ly/ExtendCompound for details.
|
123
124
|
WARNING
|
124
125
|
end
|
125
126
|
|
data/lib/sass/selector/pseudo.rb
CHANGED
@@ -134,7 +134,7 @@ module Sass
|
|
134
134
|
res = (syntactic_type == :class ? ":" : "::") + @name
|
135
135
|
if @arg || @selector
|
136
136
|
res << "("
|
137
|
-
res << @arg
|
137
|
+
res << Sass::Util.strip_except_escapes(@arg) if @arg
|
138
138
|
res << " " if @arg && @selector
|
139
139
|
res << @selector.to_s(opts) if @selector
|
140
140
|
res << ")"
|
@@ -344,8 +344,6 @@ module Sass
|
|
344
344
|
# be nil. Otherwise, this will contained the merged selector. Array
|
345
345
|
# elements are [Sass::Util#paths]-style options; conceptually, an "or"
|
346
346
|
# of multiple selectors.
|
347
|
-
# @comment
|
348
|
-
# rubocop:disable MethodLength
|
349
347
|
def merge_final_ops(seq1, seq2, res = [])
|
350
348
|
ops1, ops2 = [], []
|
351
349
|
ops1 << seq1.pop while seq1.last.is_a?(String)
|
@@ -427,8 +425,6 @@ module Sass
|
|
427
425
|
return merge_final_ops(seq1, seq2, res)
|
428
426
|
end
|
429
427
|
end
|
430
|
-
# @comment
|
431
|
-
# rubocop:enable MethodLength
|
432
428
|
|
433
429
|
# Takes initial subsequences of `seq1` and `seq2` and returns all
|
434
430
|
# orderings of those subsequences. The initial subsequences are determined
|