sass 3.2.0.alpha.61 → 3.2.0.alpha.62
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/REVISION +1 -1
- data/VERSION +1 -1
- data/lib/sass/cache_stores/filesystem.rb +0 -1
- data/lib/sass/engine.rb +1 -1
- data/lib/sass/script/funcall.rb +2 -2
- data/lib/sass/script/literal.rb +20 -0
- data/lib/sass/script/operation.rb +0 -8
- data/lib/sass/selector.rb +1 -1
- data/lib/sass/selector/sequence.rb +17 -129
- data/lib/sass/tree/visitors/convert.rb +1 -2
- data/lib/sass/tree/visitors/cssize.rb +6 -21
- data/lib/sass/tree/visitors/perform.rb +0 -2
- data/lib/sass/tree/visitors/to_css.rb +3 -11
- data/lib/sass/util.rb +0 -32
- data/test/sass/engine_test.rb +2 -28
- data/test/sass/extend_test.rb +2 -476
- data/test/sass/more_results/more_import.css +2 -2
- data/test/sass/results/import.css +2 -2
- data/test/sass/results/import_charset.css +0 -1
- data/test/sass/results/import_charset_1_8.css +0 -1
- data/test/sass/results/import_charset_ibm866.css +0 -1
- data/test/sass/results/scss_import.css +2 -2
- data/test/sass/script_test.rb +0 -5
- data/test/sass/scss/scss_test.rb +3 -3
- data/test/sass/templates/import_charset.sass +0 -2
- data/test/sass/templates/import_charset_1_8.sass +0 -2
- data/test/sass/templates/import_charset_ibm866.sass +0 -2
- data/test/sass/util_test.rb +0 -6
- metadata +11 -11
data/REVISION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b646179a5713cbb2f2156c254e0add381c1d1824
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.2.0.alpha.
|
|
1
|
+
3.2.0.alpha.62
|
data/lib/sass/engine.rb
CHANGED
|
@@ -224,7 +224,7 @@ module Sass
|
|
|
224
224
|
# If you're compiling a single Sass file from the filesystem,
|
|
225
225
|
# use \{Sass::Engine.for\_file}.
|
|
226
226
|
# If you're compiling multiple files from the filesystem,
|
|
227
|
-
# use {Sass::Plugin
|
|
227
|
+
# use {Sass::Plugin.
|
|
228
228
|
#
|
|
229
229
|
# @param template [String] The Sass template.
|
|
230
230
|
# This template can be encoded using any encoding
|
data/lib/sass/script/funcall.rb
CHANGED
|
@@ -36,7 +36,7 @@ module Sass
|
|
|
36
36
|
# @return [String] A string representation of the function call
|
|
37
37
|
def inspect
|
|
38
38
|
args = @args.map {|a| a.inspect}.join(', ')
|
|
39
|
-
keywords =
|
|
39
|
+
keywords = @keywords.sort_by {|k, v| k}.
|
|
40
40
|
map {|k, v| "$#{k}: #{v.inspect}"}.join(', ')
|
|
41
41
|
"#{name}(#{args}#{', ' unless args.empty? || keywords.empty?}#{keywords})"
|
|
42
42
|
end
|
|
@@ -44,7 +44,7 @@ module Sass
|
|
|
44
44
|
# @see Node#to_sass
|
|
45
45
|
def to_sass(opts = {})
|
|
46
46
|
args = @args.map {|a| a.to_sass(opts)}.join(', ')
|
|
47
|
-
keywords =
|
|
47
|
+
keywords = @keywords.sort_by {|k, v| k}.
|
|
48
48
|
map {|k, v| "$#{dasherize(k, opts)}: #{v.to_sass(opts)}"}.join(', ')
|
|
49
49
|
"#{dasherize(name, opts)}(#{args}#{', ' unless args.empty? || keywords.empty?}#{keywords})"
|
|
50
50
|
end
|
data/lib/sass/script/literal.rb
CHANGED
|
@@ -55,6 +55,26 @@ The #options attribute is not set on this #{self.class}.
|
|
|
55
55
|
MSG
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
# The SassScript `and` operation.
|
|
59
|
+
#
|
|
60
|
+
# @param other [Literal] The right-hand side of the operator
|
|
61
|
+
# @return [Literal] The result of a logical and:
|
|
62
|
+
# `other` if this literal isn't a false {Bool},
|
|
63
|
+
# and this literal otherwise
|
|
64
|
+
def and(other)
|
|
65
|
+
to_bool ? other : self
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# The SassScript `or` operation.
|
|
69
|
+
#
|
|
70
|
+
# @param other [Literal] The right-hand side of the operator
|
|
71
|
+
# @return [Literal] The result of the logical or:
|
|
72
|
+
# this literal if it isn't a false {Bool},
|
|
73
|
+
# and `other` otherwise
|
|
74
|
+
def or(other)
|
|
75
|
+
to_bool ? self : other
|
|
76
|
+
end
|
|
77
|
+
|
|
58
78
|
# The SassScript `==` operation.
|
|
59
79
|
# **Note that this returns a {Sass::Script::Bool} object,
|
|
60
80
|
# not a Ruby boolean**.
|
|
@@ -72,14 +72,6 @@ module Sass::Script
|
|
|
72
72
|
# @raise [Sass::SyntaxError] if the operation is undefined for the operands
|
|
73
73
|
def _perform(environment)
|
|
74
74
|
literal1 = @operand1.perform(environment)
|
|
75
|
-
|
|
76
|
-
# Special-case :and and :or to support short-circuiting.
|
|
77
|
-
if @operator == :and
|
|
78
|
-
return literal1.to_bool ? @operand2.perform(environment) : literal1
|
|
79
|
-
elsif @operator == :or
|
|
80
|
-
return literal1.to_bool ? literal1 : @operand2.perform(environment)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
75
|
literal2 = @operand2.perform(environment)
|
|
84
76
|
|
|
85
77
|
begin
|
data/lib/sass/selector.rb
CHANGED
|
@@ -379,7 +379,7 @@ module Sass
|
|
|
379
379
|
attr_reader :selector
|
|
380
380
|
|
|
381
381
|
# @param [String] The name of the pseudoclass
|
|
382
|
-
# @param [Selector::
|
|
382
|
+
# @param [Selector::Sequence] The selector argument
|
|
383
383
|
def initialize(name, selector)
|
|
384
384
|
@name = name
|
|
385
385
|
@selector = selector
|
|
@@ -124,15 +124,15 @@ module Sass
|
|
|
124
124
|
# @param path [Array<Array<SimpleSequence or String>>] A list of parenthesized selector groups.
|
|
125
125
|
# @return [Array<Array<SimpleSequence or String>>] A list of fully-expanded selectors.
|
|
126
126
|
def weave(path)
|
|
127
|
-
# This function works by moving through the selector path left-to-right,
|
|
128
|
-
# building all possible prefixes simultaneously. These prefixes are
|
|
129
|
-
# `befores`, while the remaining parenthesized suffixes is `afters`.
|
|
130
127
|
befores = [[]]
|
|
131
128
|
afters = path.dup
|
|
132
129
|
|
|
133
130
|
until afters.empty?
|
|
134
131
|
current = afters.shift.dup
|
|
135
132
|
last_current = [current.pop]
|
|
133
|
+
while !current.empty? && last_current.first.is_a?(String) || current.last.is_a?(String)
|
|
134
|
+
last_current.unshift(current.pop)
|
|
135
|
+
end
|
|
136
136
|
befores = Sass::Util.flatten(befores.map do |before|
|
|
137
137
|
next [] unless sub = subweave(before, current)
|
|
138
138
|
sub.map {|seqs| seqs + last_current}
|
|
@@ -150,12 +150,6 @@ module Sass
|
|
|
150
150
|
# `.foo .baz .bar .bang`, `.foo .baz .bar.bang`, `.foo .baz .bang .bar`,
|
|
151
151
|
# and so on until `.baz .bang .foo .bar`.
|
|
152
152
|
#
|
|
153
|
-
# Semantically, for selectors A and B, this returns all selectors `AB_i`
|
|
154
|
-
# such that the union over all i of elements matched by `AB_i X` is
|
|
155
|
-
# identical to the intersection of all elements matched by `A X` and all
|
|
156
|
-
# elements matched by `B X`. Some `AB_i` are elided to reduce the size of
|
|
157
|
-
# the output.
|
|
158
|
-
#
|
|
159
153
|
# @param seq1 [Array<SimpleSequence or String>]
|
|
160
154
|
# @param seq2 [Array<SimpleSequence or String>]
|
|
161
155
|
# @return [Array<Array<SimpleSequence or String>>]
|
|
@@ -163,34 +157,31 @@ module Sass
|
|
|
163
157
|
return [seq2] if seq1.empty?
|
|
164
158
|
return [seq1] if seq2.empty?
|
|
165
159
|
|
|
166
|
-
seq1, seq2 = seq1.dup, seq2.dup
|
|
167
160
|
return unless init = merge_initial_ops(seq1, seq2)
|
|
168
|
-
return unless fin = merge_final_ops(seq1, seq2)
|
|
169
161
|
seq1 = group_selectors(seq1)
|
|
170
162
|
seq2 = group_selectors(seq2)
|
|
171
163
|
lcs = Sass::Util.lcs(seq2, seq1) do |s1, s2|
|
|
172
164
|
next s1 if s1 == s2
|
|
173
165
|
next unless s1.first.is_a?(SimpleSequence) && s2.first.is_a?(SimpleSequence)
|
|
174
|
-
next s2 if
|
|
175
|
-
next s1 if
|
|
166
|
+
next s2 if subweave_superselector?(s1, s2)
|
|
167
|
+
next s1 if subweave_superselector?(s2, s1)
|
|
176
168
|
end
|
|
177
169
|
|
|
178
170
|
diff = [[init]]
|
|
179
171
|
until lcs.empty?
|
|
180
|
-
diff << chunks(seq1, seq2) {|s|
|
|
172
|
+
diff << chunks(seq1, seq2) {|s| subweave_superselector?(s.first, lcs.first)} << [lcs.shift]
|
|
181
173
|
seq1.shift
|
|
182
174
|
seq2.shift
|
|
183
175
|
end
|
|
184
176
|
diff << chunks(seq1, seq2) {|s| s.empty?}
|
|
185
|
-
diff += fin.map {|sel| sel.is_a?(Array) ? sel : [sel]}
|
|
186
177
|
diff.reject! {|c| c.empty?}
|
|
187
178
|
|
|
188
179
|
Sass::Util.paths(diff).map {|p| p.flatten}
|
|
189
180
|
end
|
|
190
181
|
|
|
191
|
-
# Extracts initial selector
|
|
182
|
+
# Extracts initial selector operators (`"+"`, `">"`, `"~"`, and `"\n"`)
|
|
192
183
|
# from two sequences and merges them together into a single array of
|
|
193
|
-
# selector
|
|
184
|
+
# selector operators.
|
|
194
185
|
#
|
|
195
186
|
# @param seq1 [Array<SimpleSequence or String>]
|
|
196
187
|
# @param seq2 [Array<SimpleSequence or String>]
|
|
@@ -213,100 +204,6 @@ module Sass
|
|
|
213
204
|
return (newline ? ["\n"] : []) + (ops1.size > ops2.size ? ops1 : ops2)
|
|
214
205
|
end
|
|
215
206
|
|
|
216
|
-
# Extracts final selector combinators (`"+"`, `">"`, `"~"`) and the
|
|
217
|
-
# selectors to which they apply from two sequences and merges them
|
|
218
|
-
# together into a single array.
|
|
219
|
-
#
|
|
220
|
-
# @param seq1 [Array<SimpleSequence or String>]
|
|
221
|
-
# @param seq2 [Array<SimpleSequence or String>]
|
|
222
|
-
# @return [Array<SimpleSequence or String or
|
|
223
|
-
# Array<Array<SimpleSequence or String>>]
|
|
224
|
-
# If there are no trailing combinators to be merged, this will be the
|
|
225
|
-
# empty array. If the trailing combinators cannot be merged, this will
|
|
226
|
-
# be nil. Otherwise, this will contained the merged selector. Array
|
|
227
|
-
# elements are [Sass::Util#paths]-style options; conceptually, an "or"
|
|
228
|
-
# of multiple selectors.
|
|
229
|
-
def merge_final_ops(seq1, seq2, res = [])
|
|
230
|
-
ops1, ops2 = [], []
|
|
231
|
-
ops1 << seq1.pop while seq1.last.is_a?(String)
|
|
232
|
-
ops2 << seq2.pop while seq2.last.is_a?(String)
|
|
233
|
-
|
|
234
|
-
# Not worth the headache of trying to preserve newlines here. The most
|
|
235
|
-
# important use of newlines is at the beginning of the selector to wrap
|
|
236
|
-
# across lines anyway.
|
|
237
|
-
ops1.reject! {|o| o == "\n"}
|
|
238
|
-
ops2.reject! {|o| o == "\n"}
|
|
239
|
-
|
|
240
|
-
return res if ops1.empty? && ops2.empty?
|
|
241
|
-
if ops1.size > 1 || ops2.size > 1
|
|
242
|
-
# If there are multiple operators, something hacky's going on. If one
|
|
243
|
-
# is a supersequence of the other, use that, otherwise give up.
|
|
244
|
-
lcs = Sass::Util.lcs(ops1, ops2)
|
|
245
|
-
return unless lcs == ops1 || lcs == ops2
|
|
246
|
-
res.unshift *(ops1.size > ops2.size ? ops1 : ops2).reverse
|
|
247
|
-
return res
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
# This code looks complicated, but it's actually just a bunch of special
|
|
251
|
-
# cases for interactions between different combinators.
|
|
252
|
-
op1, op2 = ops1.first, ops2.first
|
|
253
|
-
if op1 && op2
|
|
254
|
-
sel1 = seq1.pop
|
|
255
|
-
sel2 = seq2.pop
|
|
256
|
-
if op1 == '~' && op2 == '~'
|
|
257
|
-
if superselector?([sel1], [sel2])
|
|
258
|
-
res.unshift sel2, '~'
|
|
259
|
-
elsif superselector?([sel2], [sel1])
|
|
260
|
-
res.unshift sel1, '~'
|
|
261
|
-
else
|
|
262
|
-
merged = sel1.unify(sel2.members)
|
|
263
|
-
res.unshift [
|
|
264
|
-
[sel1, '~', sel2, '~'],
|
|
265
|
-
[sel2, '~', sel1, '~'],
|
|
266
|
-
([merged, '~'] if merged)
|
|
267
|
-
].compact
|
|
268
|
-
end
|
|
269
|
-
elsif (op1 == '~' && op2 == '+') || (op1 == '+' && op2 == '~')
|
|
270
|
-
if op1 == '~'
|
|
271
|
-
tilde_sel, plus_sel = sel1, sel2
|
|
272
|
-
else
|
|
273
|
-
tilde_sel, plus_sel = sel2, sel1
|
|
274
|
-
end
|
|
275
|
-
|
|
276
|
-
if superselector?([tilde_sel], [plus_sel])
|
|
277
|
-
res.unshift plus_sel, '+'
|
|
278
|
-
else
|
|
279
|
-
merged = plus_sel.unify(tilde_sel.members)
|
|
280
|
-
res.unshift [
|
|
281
|
-
[tilde_sel, '~', plus_sel, '+'],
|
|
282
|
-
([merged, '+'] if merged)
|
|
283
|
-
].compact
|
|
284
|
-
end
|
|
285
|
-
elsif op1 == '>' && %w[~ +].include?(op2)
|
|
286
|
-
res.unshift sel2, op2
|
|
287
|
-
seq1.push sel1, op1
|
|
288
|
-
elsif op2 == '>' && %w[~ +].include?(op1)
|
|
289
|
-
res.unshift sel1, op1
|
|
290
|
-
seq2.push sel2, op2
|
|
291
|
-
elsif op1 == op2
|
|
292
|
-
return unless merged = sel1.unify(sel2.members)
|
|
293
|
-
res.unshift merged, op1
|
|
294
|
-
else
|
|
295
|
-
# Unknown selector combinators can't be unified
|
|
296
|
-
return
|
|
297
|
-
end
|
|
298
|
-
return merge_final_ops(seq1, seq2, res)
|
|
299
|
-
elsif op1
|
|
300
|
-
seq2.pop if op1 == '>' && seq2.last && superselector?([seq2.last], [seq1.last])
|
|
301
|
-
res.unshift seq1.pop, op1
|
|
302
|
-
return merge_final_ops(seq1, seq2, res)
|
|
303
|
-
else # op2
|
|
304
|
-
seq1.pop if op2 == '>' && seq1.last && superselector?([seq1.last], [seq2.last])
|
|
305
|
-
res.unshift seq2.pop, op2
|
|
306
|
-
return merge_final_ops(seq1, seq2, res)
|
|
307
|
-
end
|
|
308
|
-
end
|
|
309
|
-
|
|
310
207
|
# Takes initial subsequences of `seq1` and `seq2` and returns all
|
|
311
208
|
# orderings of those subsequences. The initial subsequences are determined
|
|
312
209
|
# by a block.
|
|
@@ -326,7 +223,6 @@ module Sass
|
|
|
326
223
|
# cutting off some initial subsequence.
|
|
327
224
|
# @yieldreturn [Boolean] Whether or not to cut off the initial subsequence
|
|
328
225
|
# here.
|
|
329
|
-
# @return [Array<Array>] All possible orderings of the initial subsequences.
|
|
330
226
|
def chunks(seq1, seq2)
|
|
331
227
|
chunk1 = []
|
|
332
228
|
chunk1 << seq1.shift until yield seq1
|
|
@@ -361,33 +257,25 @@ module Sass
|
|
|
361
257
|
end
|
|
362
258
|
|
|
363
259
|
# Given two sequences of simple selectors, returns whether `sseq1` is a
|
|
364
|
-
# superselector of `sseq2
|
|
365
|
-
# `sseq2` matches.
|
|
366
|
-
#
|
|
367
|
-
# Both `sseq1` and `sseq2` are of the form
|
|
368
|
-
# `SimpleSelector (String SimpleSelector)* String*`, although selectors
|
|
369
|
-
# with a trailing operator are considered to be neither superselectors nor
|
|
370
|
-
# subselectors.
|
|
260
|
+
# superselector of `sseq2`.
|
|
371
261
|
#
|
|
372
|
-
# @param sseq1 [Array<
|
|
373
|
-
# @param sseq2 [Array<
|
|
262
|
+
# @param sseq1 [Array<SimpleSelector or String>]
|
|
263
|
+
# @param sseq2 [Array<SimpleSelector or String>]
|
|
374
264
|
# @return [Boolean]
|
|
375
|
-
def
|
|
376
|
-
sseq1 = sseq1.reject {|e| e == "\n"}
|
|
377
|
-
sseq2 = sseq2.reject {|e| e == "\n"}
|
|
378
|
-
# Selectors with trailing operators are neither superselectors nor
|
|
379
|
-
# subselectors.
|
|
380
|
-
return if sseq1.last.is_a?(String) || sseq2.last.is_a?(String)
|
|
265
|
+
def subweave_superselector?(sseq1, sseq2)
|
|
381
266
|
if sseq1.size > 1
|
|
382
267
|
# More complex selectors are never superselectors of less complex ones
|
|
383
268
|
return unless sseq2.size > 1
|
|
384
269
|
# .foo ~ .bar is a superselector of .foo + .bar
|
|
385
270
|
return unless sseq1[1] == "~" ? sseq2[1] != ">" : sseq2[1] == sseq1[1]
|
|
386
271
|
return unless sseq1.first.superselector?(sseq2.first)
|
|
387
|
-
return
|
|
272
|
+
return true if sseq1.size == 2
|
|
273
|
+
return false if sseq2.size == 2
|
|
274
|
+
return subweave_superselector?(sseq1[2..-1], sseq2[2..-1])
|
|
388
275
|
elsif sseq2.size > 1
|
|
389
276
|
return true if sseq2[1] == ">" && sseq1.first.superselector?(sseq2.first)
|
|
390
|
-
return
|
|
277
|
+
return false if sseq2.size == 2
|
|
278
|
+
return subweave_superselector?(sseq1, sseq2[2..-1])
|
|
391
279
|
else
|
|
392
280
|
sseq1.first.superselector?(sseq2.first)
|
|
393
281
|
end
|
|
@@ -168,8 +168,7 @@ class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
|
|
|
168
168
|
def visit_mixin(node)
|
|
169
169
|
unless node.args.empty? && node.keywords.empty?
|
|
170
170
|
args = node.args.map {|a| a.to_sass(@options)}.join(", ")
|
|
171
|
-
keywords =
|
|
172
|
-
map {|k, v| "$#{dasherize(k)}: #{v.to_sass(@options)}"}.join(', ')
|
|
171
|
+
keywords = node.keywords.map {|k, v| "$#{dasherize(k)}: #{v.to_sass(@options)}"}.join(', ')
|
|
173
172
|
arglist = "(#{args}#{', ' unless args.empty? || keywords.empty?}#{keywords})"
|
|
174
173
|
end
|
|
175
174
|
"#{tab_str}#{@format == :sass ? '+' : '@include '}#{dasherize(node.name)}#{arglist}#{node.has_children ? yield : semi}\n"
|
|
@@ -52,27 +52,12 @@ class Sass::Tree::Visitors::Cssize < Sass::Tree::Visitors::Base
|
|
|
52
52
|
def visit_root(node)
|
|
53
53
|
yield
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
node.children.unshift charset if charset
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
imports = Sass::Util.extract!(node.children) do |c|
|
|
65
|
-
c.is_a?(Sass::Tree::DirectiveNode) && !c.is_a?(Sass::Tree::MediaNode) &&
|
|
66
|
-
c.resolved_value =~ /^@import /i
|
|
67
|
-
end
|
|
68
|
-
charset_and_index = Sass::Util.ruby1_8? &&
|
|
69
|
-
node.children.each_with_index.find {|c, _| c.is_a?(Sass::Tree::CharsetNode)}
|
|
70
|
-
if charset_and_index
|
|
71
|
-
index = charset_and_index.last
|
|
72
|
-
node.children = node.children[0..index] + imports + node.children[index+1..-1]
|
|
73
|
-
else
|
|
74
|
-
node.children = imports + node.children
|
|
75
|
-
end
|
|
55
|
+
# In Ruby 1.9 we can make all @charset nodes invisible
|
|
56
|
+
# and infer the final @charset from the encoding of the final string.
|
|
57
|
+
if Sass::Util.ruby1_8? && parent.nil?
|
|
58
|
+
charset = node.children.find {|c| c.is_a?(Sass::Tree::CharsetNode)}
|
|
59
|
+
node.children.reject! {|c| c.is_a?(Sass::Tree::CharsetNode)}
|
|
60
|
+
node.children.unshift charset if charset
|
|
76
61
|
end
|
|
77
62
|
|
|
78
63
|
return node, @extends
|
|
@@ -247,8 +247,6 @@ END
|
|
|
247
247
|
# Runs SassScript interpolation in the selector,
|
|
248
248
|
# and then parses the result into a {Sass::Selector::CommaSequence}.
|
|
249
249
|
def visit_rule(node)
|
|
250
|
-
rule = node.rule
|
|
251
|
-
rule = rule.map {|e| e.is_a?(String) && e != ' ' ? e.strip : e} if node.style == :compressed
|
|
252
250
|
parser = Sass::SCSS::StaticParser.new(run_interp(node.rule), node.filename, node.line)
|
|
253
251
|
node.parsed_rules ||= parser.parse_selector
|
|
254
252
|
if node.options[:trace_selectors]
|
|
@@ -67,10 +67,8 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def visit_directive(node)
|
|
70
|
-
was_in_directive = @in_directive
|
|
71
70
|
return node.resolved_value + ";" unless node.has_children
|
|
72
71
|
return node.resolved_value + " {}" if node.children.empty?
|
|
73
|
-
@in_directive = @in_directive || !node.is_a?(Sass::Tree::MediaNode)
|
|
74
72
|
result = if node.style == :compressed
|
|
75
73
|
"#{node.resolved_value}{"
|
|
76
74
|
else
|
|
@@ -103,8 +101,6 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
|
|
|
103
101
|
else
|
|
104
102
|
(node.style == :expanded ? "\n" : " ") + "}\n"
|
|
105
103
|
end
|
|
106
|
-
ensure
|
|
107
|
-
@in_directive = was_in_directive
|
|
108
104
|
end
|
|
109
105
|
|
|
110
106
|
def visit_media(node)
|
|
@@ -137,11 +133,7 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
|
|
|
137
133
|
joined_rules = node.resolved_rules.members.map do |seq|
|
|
138
134
|
next if seq.has_placeholder?
|
|
139
135
|
rule_part = seq.to_a.join
|
|
140
|
-
if node.style == :compressed
|
|
141
|
-
rule_part.gsub!(/([^,])\s*\n\s*/m, '\1 ')
|
|
142
|
-
rule_part.gsub!(/\s*([,+>])\s*/m, '\1')
|
|
143
|
-
rule_part.strip!
|
|
144
|
-
end
|
|
136
|
+
rule_part.gsub!(/\s*([^,])\s*\n\s*/m, '\1 ') if node.style == :compressed
|
|
145
137
|
rule_part
|
|
146
138
|
end.compact.join(rule_separator)
|
|
147
139
|
|
|
@@ -153,7 +145,7 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
|
|
|
153
145
|
old_spaces = ' ' * @tabs
|
|
154
146
|
spaces = ' ' * (@tabs + 1)
|
|
155
147
|
if node.style != :compressed
|
|
156
|
-
if node.options[:debug_info]
|
|
148
|
+
if node.options[:debug_info]
|
|
157
149
|
to_return << visit(debug_info_rule(node.debug_info, node.options)) << "\n"
|
|
158
150
|
elsif node.options[:trace_selectors]
|
|
159
151
|
to_return << "#{old_spaces}/* "
|
|
@@ -199,7 +191,7 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
|
|
|
199
191
|
|
|
200
192
|
def debug_info_rule(debug_info, options)
|
|
201
193
|
node = Sass::Tree::DirectiveNode.resolved("@media -sass-debug-info")
|
|
202
|
-
|
|
194
|
+
debug_info.map {|k, v| [k.to_s, v.to_s]}.sort.each do |k, v|
|
|
203
195
|
rule = Sass::Tree::RuleNode.new([""])
|
|
204
196
|
rule.resolved_rules = Sass::Selector::CommaSequence.new(
|
|
205
197
|
[Sass::Selector::Sequence.new(
|
data/lib/sass/util.rb
CHANGED
|
@@ -218,20 +218,6 @@ module Sass
|
|
|
218
218
|
lcs_backtrace(lcs_table(x, y, &block), x, y, x.size-1, y.size-1, &block)
|
|
219
219
|
end
|
|
220
220
|
|
|
221
|
-
# Converts a Hash to an Array. This is usually identical to `Hash#to_a`,
|
|
222
|
-
# with the following exceptions:
|
|
223
|
-
#
|
|
224
|
-
# * In Ruby 1.8, `Hash#to_a` is not deterministically ordered, but this is.
|
|
225
|
-
# * In Ruby 1.9 when running tests, this is ordered in the same way it would
|
|
226
|
-
# be under Ruby 1.8 (sorted key order rather than insertion order).
|
|
227
|
-
#
|
|
228
|
-
# @param hash [Hash]
|
|
229
|
-
# @return [Array]
|
|
230
|
-
def hash_to_a(hash)
|
|
231
|
-
return has.to_a unless ruby1_8? || defined?(Test::Unit)
|
|
232
|
-
return hash.sort_by {|k, v| k}
|
|
233
|
-
end
|
|
234
|
-
|
|
235
221
|
# Returns information about the caller of the previous method.
|
|
236
222
|
#
|
|
237
223
|
# @param entry [String] An entry in the `#caller` list, or a similarly formatted string
|
|
@@ -575,24 +561,6 @@ MSG
|
|
|
575
561
|
ruby1_8? ? enum.enum_slice(n) : enum.each_slice(n)
|
|
576
562
|
end
|
|
577
563
|
|
|
578
|
-
# Destructively removes all elements from an array that match a block, and
|
|
579
|
-
# returns the removed elements.
|
|
580
|
-
#
|
|
581
|
-
# @param array [Array] The array from which to remove elements.
|
|
582
|
-
# @yield [el] Called for each element.
|
|
583
|
-
# @yieldparam el [*] The element to test.
|
|
584
|
-
# @yieldreturn [Boolean] Whether or not to extract the element.
|
|
585
|
-
# @return [Array] The extracted elements.
|
|
586
|
-
def extract!(array)
|
|
587
|
-
out = []
|
|
588
|
-
array.reject! do |e|
|
|
589
|
-
next false unless yield e
|
|
590
|
-
out << e
|
|
591
|
-
true
|
|
592
|
-
end
|
|
593
|
-
out
|
|
594
|
-
end
|
|
595
|
-
|
|
596
564
|
# Returns the ASCII code of the given character.
|
|
597
565
|
#
|
|
598
566
|
# @param c [String] All characters but the first are ignored.
|
data/test/sass/engine_test.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
|
-
require
|
|
4
|
-
require
|
|
3
|
+
require 'test_helper'
|
|
4
|
+
require 'sass/test_helper'
|
|
5
5
|
require 'sass/engine'
|
|
6
6
|
require 'stringio'
|
|
7
7
|
require 'mock_importer'
|
|
@@ -1028,23 +1028,6 @@ foo
|
|
|
1028
1028
|
SASS
|
|
1029
1029
|
end
|
|
1030
1030
|
|
|
1031
|
-
def test_debug_info_in_keyframes
|
|
1032
|
-
assert_equal(<<CSS, render(<<SASS, :debug_info => true))
|
|
1033
|
-
@-webkit-keyframes warm {
|
|
1034
|
-
from {
|
|
1035
|
-
color: black; }
|
|
1036
|
-
|
|
1037
|
-
to {
|
|
1038
|
-
color: red; } }
|
|
1039
|
-
CSS
|
|
1040
|
-
@-webkit-keyframes warm
|
|
1041
|
-
from
|
|
1042
|
-
color: black
|
|
1043
|
-
to
|
|
1044
|
-
color: red
|
|
1045
|
-
SASS
|
|
1046
|
-
end
|
|
1047
|
-
|
|
1048
1031
|
def test_empty_first_line
|
|
1049
1032
|
assert_equal("#a {\n b: c; }\n", render("#a\n\n b: c"))
|
|
1050
1033
|
end
|
|
@@ -2579,15 +2562,6 @@ CSS
|
|
|
2579
2562
|
SASS
|
|
2580
2563
|
end
|
|
2581
2564
|
|
|
2582
|
-
def test_selector_compression
|
|
2583
|
-
assert_equal <<CSS, render(<<SASS, :style => :compressed)
|
|
2584
|
-
a>b,c+d,:-moz-any(e,f,g){h:i}
|
|
2585
|
-
CSS
|
|
2586
|
-
a > b, c + d, :-moz-any(e, f, g)
|
|
2587
|
-
h: i
|
|
2588
|
-
SASS
|
|
2589
|
-
end
|
|
2590
|
-
|
|
2591
2565
|
# Encodings
|
|
2592
2566
|
|
|
2593
2567
|
unless Sass::Util.ruby1_8?
|
data/test/sass/extend_test.rb
CHANGED
|
@@ -1165,70 +1165,6 @@ SCSS
|
|
|
1165
1165
|
CSS
|
|
1166
1166
|
.baz.foo {a: b}
|
|
1167
1167
|
foo > bar {@extend .foo}
|
|
1168
|
-
SCSS
|
|
1169
|
-
|
|
1170
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1171
|
-
.baz > .foo, .baz > .bar {
|
|
1172
|
-
a: b; }
|
|
1173
|
-
CSS
|
|
1174
|
-
.baz > {
|
|
1175
|
-
.foo {a: b}
|
|
1176
|
-
.bar {@extend .foo}
|
|
1177
|
-
}
|
|
1178
|
-
SCSS
|
|
1179
|
-
|
|
1180
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1181
|
-
.foo .bar, .foo > .baz {
|
|
1182
|
-
a: b; }
|
|
1183
|
-
CSS
|
|
1184
|
-
.foo {
|
|
1185
|
-
.bar {a: b}
|
|
1186
|
-
> .baz {@extend .bar}
|
|
1187
|
-
}
|
|
1188
|
-
SCSS
|
|
1189
|
-
|
|
1190
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1191
|
-
.foo .bar, .foo .bip > .baz {
|
|
1192
|
-
a: b; }
|
|
1193
|
-
CSS
|
|
1194
|
-
.foo {
|
|
1195
|
-
.bar {a: b}
|
|
1196
|
-
.bip > .baz {@extend .bar}
|
|
1197
|
-
}
|
|
1198
|
-
SCSS
|
|
1199
|
-
|
|
1200
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1201
|
-
.foo .bip .bar, .foo .bip .foo > .baz {
|
|
1202
|
-
a: b; }
|
|
1203
|
-
CSS
|
|
1204
|
-
.foo {
|
|
1205
|
-
.bip .bar {a: b}
|
|
1206
|
-
> .baz {@extend .bar}
|
|
1207
|
-
}
|
|
1208
|
-
SCSS
|
|
1209
|
-
|
|
1210
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1211
|
-
.foo > .bar, .foo > .bip + .baz {
|
|
1212
|
-
a: b; }
|
|
1213
|
-
CSS
|
|
1214
|
-
.foo > .bar {a: b}
|
|
1215
|
-
.bip + .baz {@extend .bar}
|
|
1216
|
-
SCSS
|
|
1217
|
-
|
|
1218
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1219
|
-
.foo + .bar, .bip > .foo + .baz {
|
|
1220
|
-
a: b; }
|
|
1221
|
-
CSS
|
|
1222
|
-
.foo + .bar {a: b}
|
|
1223
|
-
.bip > .baz {@extend .bar}
|
|
1224
|
-
SCSS
|
|
1225
|
-
|
|
1226
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1227
|
-
.foo > .bar, .bip.foo > .baz {
|
|
1228
|
-
a: b; }
|
|
1229
|
-
CSS
|
|
1230
|
-
.foo > .bar {a: b}
|
|
1231
|
-
.bip > .baz {@extend .bar}
|
|
1232
1168
|
SCSS
|
|
1233
1169
|
end
|
|
1234
1170
|
|
|
@@ -1250,7 +1186,7 @@ SCSS
|
|
|
1250
1186
|
|
|
1251
1187
|
def test_nested_extender_with_hacky_selector
|
|
1252
1188
|
assert_equal <<CSS, render(<<SCSS)
|
|
1253
|
-
.baz .foo, .baz foo + > > + bar
|
|
1189
|
+
.baz .foo, .baz foo + > > + bar {
|
|
1254
1190
|
a: b; }
|
|
1255
1191
|
CSS
|
|
1256
1192
|
.baz .foo {a: b}
|
|
@@ -1258,7 +1194,7 @@ foo + > > + bar {@extend .foo}
|
|
|
1258
1194
|
SCSS
|
|
1259
1195
|
|
|
1260
1196
|
assert_equal <<CSS, render(<<SCSS)
|
|
1261
|
-
.baz .foo, > >
|
|
1197
|
+
.baz .foo, .baz > > bar {
|
|
1262
1198
|
a: b; }
|
|
1263
1199
|
CSS
|
|
1264
1200
|
.baz .foo {a: b}
|
|
@@ -1287,402 +1223,6 @@ CSS
|
|
|
1287
1223
|
SCSS
|
|
1288
1224
|
end
|
|
1289
1225
|
|
|
1290
|
-
# Combinator Unification
|
|
1291
|
-
|
|
1292
|
-
def test_combinator_unification_for_hacky_combinators
|
|
1293
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1294
|
-
.a > + x, .a .b > + y, .b .a > + y {
|
|
1295
|
-
a: b; }
|
|
1296
|
-
CSS
|
|
1297
|
-
.a > + x {a: b}
|
|
1298
|
-
.b y {@extend x}
|
|
1299
|
-
SCSS
|
|
1300
|
-
|
|
1301
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1302
|
-
.a x, .a .b > + y, .b .a > + y {
|
|
1303
|
-
a: b; }
|
|
1304
|
-
CSS
|
|
1305
|
-
.a x {a: b}
|
|
1306
|
-
.b > + y {@extend x}
|
|
1307
|
-
SCSS
|
|
1308
|
-
|
|
1309
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1310
|
-
.a > + x, .a .b > + y, .b .a > + y {
|
|
1311
|
-
a: b; }
|
|
1312
|
-
CSS
|
|
1313
|
-
.a > + x {a: b}
|
|
1314
|
-
.b > + y {@extend x}
|
|
1315
|
-
SCSS
|
|
1316
|
-
|
|
1317
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1318
|
-
.a ~ > + x, .a .b ~ > + y, .b .a ~ > + y {
|
|
1319
|
-
a: b; }
|
|
1320
|
-
CSS
|
|
1321
|
-
.a ~ > + x {a: b}
|
|
1322
|
-
.b > + y {@extend x}
|
|
1323
|
-
SCSS
|
|
1324
|
-
|
|
1325
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1326
|
-
.a + > x {
|
|
1327
|
-
a: b; }
|
|
1328
|
-
CSS
|
|
1329
|
-
.a + > x {a: b}
|
|
1330
|
-
.b > + y {@extend x}
|
|
1331
|
-
SCSS
|
|
1332
|
-
|
|
1333
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1334
|
-
.a + > x {
|
|
1335
|
-
a: b; }
|
|
1336
|
-
CSS
|
|
1337
|
-
.a + > x {a: b}
|
|
1338
|
-
.b > + y {@extend x}
|
|
1339
|
-
SCSS
|
|
1340
|
-
|
|
1341
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1342
|
-
.a ~ > + .b > x, .a .c ~ > + .d.b > y, .c .a ~ > + .d.b > y {
|
|
1343
|
-
a: b; }
|
|
1344
|
-
CSS
|
|
1345
|
-
.a ~ > + .b > x {a: b}
|
|
1346
|
-
.c > + .d > y {@extend x}
|
|
1347
|
-
SCSS
|
|
1348
|
-
end
|
|
1349
|
-
|
|
1350
|
-
def test_combinator_unification_double_tilde
|
|
1351
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1352
|
-
.a.b ~ x, .a.b ~ y {
|
|
1353
|
-
a: b; }
|
|
1354
|
-
CSS
|
|
1355
|
-
.a.b ~ x {a: b}
|
|
1356
|
-
.a ~ y {@extend x}
|
|
1357
|
-
SCSS
|
|
1358
|
-
|
|
1359
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1360
|
-
.a ~ x, .a.b ~ y {
|
|
1361
|
-
a: b; }
|
|
1362
|
-
CSS
|
|
1363
|
-
.a ~ x {a: b}
|
|
1364
|
-
.a.b ~ y {@extend x}
|
|
1365
|
-
SCSS
|
|
1366
|
-
|
|
1367
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1368
|
-
.a ~ x, .a ~ .b ~ y, .b ~ .a ~ y, .b.a ~ y {
|
|
1369
|
-
a: b; }
|
|
1370
|
-
CSS
|
|
1371
|
-
.a ~ x {a: b}
|
|
1372
|
-
.b ~ y {@extend x}
|
|
1373
|
-
SCSS
|
|
1374
|
-
|
|
1375
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1376
|
-
a.a ~ x, a.a ~ b.b ~ y, b.b ~ a.a ~ y {
|
|
1377
|
-
a: b; }
|
|
1378
|
-
CSS
|
|
1379
|
-
a.a ~ x {a: b}
|
|
1380
|
-
b.b ~ y {@extend x}
|
|
1381
|
-
SCSS
|
|
1382
|
-
end
|
|
1383
|
-
|
|
1384
|
-
def test_combinator_unification_tilde_plus
|
|
1385
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1386
|
-
.a.b + x, .a.b + y {
|
|
1387
|
-
a: b; }
|
|
1388
|
-
CSS
|
|
1389
|
-
.a.b + x {a: b}
|
|
1390
|
-
.a ~ y {@extend x}
|
|
1391
|
-
SCSS
|
|
1392
|
-
|
|
1393
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1394
|
-
.a + x, .a.b ~ .a + y, .a.b + y {
|
|
1395
|
-
a: b; }
|
|
1396
|
-
CSS
|
|
1397
|
-
.a + x {a: b}
|
|
1398
|
-
.a.b ~ y {@extend x}
|
|
1399
|
-
SCSS
|
|
1400
|
-
|
|
1401
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1402
|
-
.a + x, .b ~ .a + y, .b.a + y {
|
|
1403
|
-
a: b; }
|
|
1404
|
-
CSS
|
|
1405
|
-
.a + x {a: b}
|
|
1406
|
-
.b ~ y {@extend x}
|
|
1407
|
-
SCSS
|
|
1408
|
-
|
|
1409
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1410
|
-
a.a + x, b.b ~ a.a + y {
|
|
1411
|
-
a: b; }
|
|
1412
|
-
CSS
|
|
1413
|
-
a.a + x {a: b}
|
|
1414
|
-
b.b ~ y {@extend x}
|
|
1415
|
-
SCSS
|
|
1416
|
-
|
|
1417
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1418
|
-
.a.b ~ x, .a.b ~ .a + y, .a.b + y {
|
|
1419
|
-
a: b; }
|
|
1420
|
-
CSS
|
|
1421
|
-
.a.b ~ x {a: b}
|
|
1422
|
-
.a + y {@extend x}
|
|
1423
|
-
SCSS
|
|
1424
|
-
|
|
1425
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1426
|
-
.a ~ x, .a.b + y {
|
|
1427
|
-
a: b; }
|
|
1428
|
-
CSS
|
|
1429
|
-
.a ~ x {a: b}
|
|
1430
|
-
.a.b + y {@extend x}
|
|
1431
|
-
SCSS
|
|
1432
|
-
|
|
1433
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1434
|
-
.a ~ x, .a ~ .b + y, .a.b + y {
|
|
1435
|
-
a: b; }
|
|
1436
|
-
CSS
|
|
1437
|
-
.a ~ x {a: b}
|
|
1438
|
-
.b + y {@extend x}
|
|
1439
|
-
SCSS
|
|
1440
|
-
|
|
1441
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1442
|
-
a.a ~ x, a.a ~ b.b + y {
|
|
1443
|
-
a: b; }
|
|
1444
|
-
CSS
|
|
1445
|
-
a.a ~ x {a: b}
|
|
1446
|
-
b.b + y {@extend x}
|
|
1447
|
-
SCSS
|
|
1448
|
-
end
|
|
1449
|
-
|
|
1450
|
-
def test_combinator_unification_angle_sibling
|
|
1451
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1452
|
-
.a > x, .a > .b ~ y {
|
|
1453
|
-
a: b; }
|
|
1454
|
-
CSS
|
|
1455
|
-
.a > x {a: b}
|
|
1456
|
-
.b ~ y {@extend x}
|
|
1457
|
-
SCSS
|
|
1458
|
-
|
|
1459
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1460
|
-
.a > x, .a > .b + y {
|
|
1461
|
-
a: b; }
|
|
1462
|
-
CSS
|
|
1463
|
-
.a > x {a: b}
|
|
1464
|
-
.b + y {@extend x}
|
|
1465
|
-
SCSS
|
|
1466
|
-
|
|
1467
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1468
|
-
.a ~ x, .b > .a ~ y {
|
|
1469
|
-
a: b; }
|
|
1470
|
-
CSS
|
|
1471
|
-
.a ~ x {a: b}
|
|
1472
|
-
.b > y {@extend x}
|
|
1473
|
-
SCSS
|
|
1474
|
-
|
|
1475
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1476
|
-
.a + x, .b > .a + y {
|
|
1477
|
-
a: b; }
|
|
1478
|
-
CSS
|
|
1479
|
-
.a + x {a: b}
|
|
1480
|
-
.b > y {@extend x}
|
|
1481
|
-
SCSS
|
|
1482
|
-
end
|
|
1483
|
-
|
|
1484
|
-
def test_combinator_unification_double_angle
|
|
1485
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1486
|
-
.a.b > x, .b.a > y {
|
|
1487
|
-
a: b; }
|
|
1488
|
-
CSS
|
|
1489
|
-
.a.b > x {a: b}
|
|
1490
|
-
.b > y {@extend x}
|
|
1491
|
-
SCSS
|
|
1492
|
-
|
|
1493
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1494
|
-
.a > x, .a.b > y {
|
|
1495
|
-
a: b; }
|
|
1496
|
-
CSS
|
|
1497
|
-
.a > x {a: b}
|
|
1498
|
-
.a.b > y {@extend x}
|
|
1499
|
-
SCSS
|
|
1500
|
-
|
|
1501
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1502
|
-
.a > x, .b.a > y {
|
|
1503
|
-
a: b; }
|
|
1504
|
-
CSS
|
|
1505
|
-
.a > x {a: b}
|
|
1506
|
-
.b > y {@extend x}
|
|
1507
|
-
SCSS
|
|
1508
|
-
|
|
1509
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1510
|
-
a.a > x {
|
|
1511
|
-
a: b; }
|
|
1512
|
-
CSS
|
|
1513
|
-
a.a > x {a: b}
|
|
1514
|
-
b.b > y {@extend x}
|
|
1515
|
-
SCSS
|
|
1516
|
-
end
|
|
1517
|
-
|
|
1518
|
-
def test_combinator_unification_double_plus
|
|
1519
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1520
|
-
.a.b + x, .b.a + y {
|
|
1521
|
-
a: b; }
|
|
1522
|
-
CSS
|
|
1523
|
-
.a.b + x {a: b}
|
|
1524
|
-
.b + y {@extend x}
|
|
1525
|
-
SCSS
|
|
1526
|
-
|
|
1527
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1528
|
-
.a + x, .a.b + y {
|
|
1529
|
-
a: b; }
|
|
1530
|
-
CSS
|
|
1531
|
-
.a + x {a: b}
|
|
1532
|
-
.a.b + y {@extend x}
|
|
1533
|
-
SCSS
|
|
1534
|
-
|
|
1535
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1536
|
-
.a + x, .b.a + y {
|
|
1537
|
-
a: b; }
|
|
1538
|
-
CSS
|
|
1539
|
-
.a + x {a: b}
|
|
1540
|
-
.b + y {@extend x}
|
|
1541
|
-
SCSS
|
|
1542
|
-
|
|
1543
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1544
|
-
a.a + x {
|
|
1545
|
-
a: b; }
|
|
1546
|
-
CSS
|
|
1547
|
-
a.a + x {a: b}
|
|
1548
|
-
b.b + y {@extend x}
|
|
1549
|
-
SCSS
|
|
1550
|
-
end
|
|
1551
|
-
|
|
1552
|
-
def test_combinator_unification_angle_space
|
|
1553
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1554
|
-
.a.b > x, .a.b > y {
|
|
1555
|
-
a: b; }
|
|
1556
|
-
CSS
|
|
1557
|
-
.a.b > x {a: b}
|
|
1558
|
-
.a y {@extend x}
|
|
1559
|
-
SCSS
|
|
1560
|
-
|
|
1561
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1562
|
-
.a > x, .a.b .a > y {
|
|
1563
|
-
a: b; }
|
|
1564
|
-
CSS
|
|
1565
|
-
.a > x {a: b}
|
|
1566
|
-
.a.b y {@extend x}
|
|
1567
|
-
SCSS
|
|
1568
|
-
|
|
1569
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1570
|
-
.a > x, .b .a > y {
|
|
1571
|
-
a: b; }
|
|
1572
|
-
CSS
|
|
1573
|
-
.a > x {a: b}
|
|
1574
|
-
.b y {@extend x}
|
|
1575
|
-
SCSS
|
|
1576
|
-
|
|
1577
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1578
|
-
.a.b x, .a.b .a > y {
|
|
1579
|
-
a: b; }
|
|
1580
|
-
CSS
|
|
1581
|
-
.a.b x {a: b}
|
|
1582
|
-
.a > y {@extend x}
|
|
1583
|
-
SCSS
|
|
1584
|
-
|
|
1585
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1586
|
-
.a x, .a.b > y {
|
|
1587
|
-
a: b; }
|
|
1588
|
-
CSS
|
|
1589
|
-
.a x {a: b}
|
|
1590
|
-
.a.b > y {@extend x}
|
|
1591
|
-
SCSS
|
|
1592
|
-
|
|
1593
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1594
|
-
.a x, .a .b > y {
|
|
1595
|
-
a: b; }
|
|
1596
|
-
CSS
|
|
1597
|
-
.a x {a: b}
|
|
1598
|
-
.b > y {@extend x}
|
|
1599
|
-
SCSS
|
|
1600
|
-
end
|
|
1601
|
-
|
|
1602
|
-
def test_combinator_unification_plus_space
|
|
1603
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1604
|
-
.a.b + x, .a .a.b + y {
|
|
1605
|
-
a: b; }
|
|
1606
|
-
CSS
|
|
1607
|
-
.a.b + x {a: b}
|
|
1608
|
-
.a y {@extend x}
|
|
1609
|
-
SCSS
|
|
1610
|
-
|
|
1611
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1612
|
-
.a + x, .a.b .a + y {
|
|
1613
|
-
a: b; }
|
|
1614
|
-
CSS
|
|
1615
|
-
.a + x {a: b}
|
|
1616
|
-
.a.b y {@extend x}
|
|
1617
|
-
SCSS
|
|
1618
|
-
|
|
1619
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1620
|
-
.a + x, .b .a + y {
|
|
1621
|
-
a: b; }
|
|
1622
|
-
CSS
|
|
1623
|
-
.a + x {a: b}
|
|
1624
|
-
.b y {@extend x}
|
|
1625
|
-
SCSS
|
|
1626
|
-
|
|
1627
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1628
|
-
.a.b x, .a.b .a + y {
|
|
1629
|
-
a: b; }
|
|
1630
|
-
CSS
|
|
1631
|
-
.a.b x {a: b}
|
|
1632
|
-
.a + y {@extend x}
|
|
1633
|
-
SCSS
|
|
1634
|
-
|
|
1635
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1636
|
-
.a x, .a .a.b + y {
|
|
1637
|
-
a: b; }
|
|
1638
|
-
CSS
|
|
1639
|
-
.a x {a: b}
|
|
1640
|
-
.a.b + y {@extend x}
|
|
1641
|
-
SCSS
|
|
1642
|
-
|
|
1643
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1644
|
-
.a x, .a .b + y {
|
|
1645
|
-
a: b; }
|
|
1646
|
-
CSS
|
|
1647
|
-
.a x {a: b}
|
|
1648
|
-
.b + y {@extend x}
|
|
1649
|
-
SCSS
|
|
1650
|
-
end
|
|
1651
|
-
|
|
1652
|
-
def test_combinator_unification_nested
|
|
1653
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1654
|
-
.a > .b + x, .c.a > .d.b + y {
|
|
1655
|
-
a: b; }
|
|
1656
|
-
CSS
|
|
1657
|
-
.a > .b + x {a: b}
|
|
1658
|
-
.c > .d + y {@extend x}
|
|
1659
|
-
SCSS
|
|
1660
|
-
|
|
1661
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1662
|
-
.a > .b + x, .c.a > .b + y {
|
|
1663
|
-
a: b; }
|
|
1664
|
-
CSS
|
|
1665
|
-
.a > .b + x {a: b}
|
|
1666
|
-
.c > y {@extend x}
|
|
1667
|
-
SCSS
|
|
1668
|
-
end
|
|
1669
|
-
|
|
1670
|
-
def test_combinator_unification_with_newlines
|
|
1671
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1672
|
-
.a >
|
|
1673
|
-
.b
|
|
1674
|
-
+ x, .c.a > .d.b + y {
|
|
1675
|
-
a: b; }
|
|
1676
|
-
CSS
|
|
1677
|
-
.a >
|
|
1678
|
-
.b
|
|
1679
|
-
+ x {a: b}
|
|
1680
|
-
.c
|
|
1681
|
-
> .d +
|
|
1682
|
-
y {@extend x}
|
|
1683
|
-
SCSS
|
|
1684
|
-
end
|
|
1685
|
-
|
|
1686
1226
|
# Loops
|
|
1687
1227
|
|
|
1688
1228
|
def test_extend_self_loop
|
|
@@ -1891,20 +1431,6 @@ SCSS
|
|
|
1891
1431
|
|
|
1892
1432
|
# Regression Tests
|
|
1893
1433
|
|
|
1894
|
-
def test_newline_near_combinator
|
|
1895
|
-
assert_equal <<CSS, render(<<SCSS)
|
|
1896
|
-
.a +
|
|
1897
|
-
.b x, .a +
|
|
1898
|
-
.b .c y, .c .a +
|
|
1899
|
-
.b y {
|
|
1900
|
-
a: b; }
|
|
1901
|
-
CSS
|
|
1902
|
-
.a +
|
|
1903
|
-
.b x {a: b}
|
|
1904
|
-
.c y {@extend x}
|
|
1905
|
-
SCSS
|
|
1906
|
-
end
|
|
1907
|
-
|
|
1908
1434
|
def test_duplicated_selector_with_newlines
|
|
1909
1435
|
assert_equal(<<CSS, render(<<SCSS))
|
|
1910
1436
|
.example-1-1,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@import url(basic.css);
|
|
2
|
-
@import url(../results/complex.css);
|
|
3
1
|
imported { otherconst: hello; myconst: goodbye; pre-mixin: here; }
|
|
4
2
|
|
|
5
3
|
body { font: Arial; background: blue; }
|
|
@@ -24,6 +22,8 @@ body { font: Arial; background: blue; }
|
|
|
24
22
|
#content.user.show #container.top #column.right { width: 600px; }
|
|
25
23
|
#content.user.show #container.bottom { background: brown; }
|
|
26
24
|
|
|
25
|
+
@import url(basic.css);
|
|
26
|
+
@import url(../results/complex.css);
|
|
27
27
|
#foo { background-color: #bbaaff; }
|
|
28
28
|
|
|
29
29
|
nonimported { myconst: hello; otherconst: goodbye; post-mixin: here; }
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@import url(basic.css);
|
|
2
|
-
@import url(../results/complex.css);
|
|
3
1
|
imported { otherconst: hello; myconst: goodbye; pre-mixin: here; }
|
|
4
2
|
|
|
5
3
|
body { font: Arial; background: blue; }
|
|
@@ -26,6 +24,8 @@ body { font: Arial; background: blue; }
|
|
|
26
24
|
#content.user.show #container.top #column.right { width: 600px; }
|
|
27
25
|
#content.user.show #container.bottom { background: brown; }
|
|
28
26
|
|
|
27
|
+
@import url(basic.css);
|
|
28
|
+
@import url(../results/complex.css);
|
|
29
29
|
#foo { background-color: #bbaaff; }
|
|
30
30
|
|
|
31
31
|
nonimported { myconst: hello; otherconst: goodbye; post-mixin: here; }
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@import url(basic.css);
|
|
2
|
-
@import url(../results/complex.css);
|
|
3
1
|
imported { otherconst: hello; myconst: goodbye; pre-mixin: here; }
|
|
4
2
|
|
|
5
3
|
body { font: Arial; background: blue; }
|
|
@@ -26,6 +24,8 @@ body { font: Arial; background: blue; }
|
|
|
26
24
|
#content.user.show #container.top #column.right { width: 600px; }
|
|
27
25
|
#content.user.show #container.bottom { background: brown; }
|
|
28
26
|
|
|
27
|
+
@import url(basic.css);
|
|
28
|
+
@import url(../results/complex.css);
|
|
29
29
|
#foo { background-color: #bbaaff; }
|
|
30
30
|
|
|
31
31
|
nonimported { myconst: hello; otherconst: goodbye; post-mixin: here; }
|
data/test/sass/script_test.rb
CHANGED
|
@@ -432,11 +432,6 @@ SASS
|
|
|
432
432
|
assert_raise_message(Sass::SyntaxError, "wrong number of arguments (1 for 0) for `arg-error'") {resolve("arg-error(1)")}
|
|
433
433
|
end
|
|
434
434
|
|
|
435
|
-
def test_boolean_ops_short_circuit
|
|
436
|
-
assert_equal "false", resolve("$ie and $ie <= 7", {}, env('ie' => Sass::Script::Bool.new(false)))
|
|
437
|
-
assert_equal "true", resolve("$ie or $undef", {}, env('ie' => Sass::Script::Bool.new(true)))
|
|
438
|
-
end
|
|
439
|
-
|
|
440
435
|
# Regression Tests
|
|
441
436
|
|
|
442
437
|
def test_funcall_has_higher_precedence_than_color_name
|
data/test/sass/scss/scss_test.rb
CHANGED
|
@@ -1245,11 +1245,11 @@ SCSS
|
|
|
1245
1245
|
|
|
1246
1246
|
|
|
1247
1247
|
def test_newlines_removed_from_selectors_when_compressed
|
|
1248
|
-
assert_equal <<CSS, render(<<SCSS, :style
|
|
1248
|
+
assert_equal <<CSS, render(<<SCSS, :style=>:compressed)
|
|
1249
1249
|
z a,z b{display:block}
|
|
1250
1250
|
CSS
|
|
1251
|
-
a
|
|
1252
|
-
|
|
1251
|
+
a,
|
|
1252
|
+
b {
|
|
1253
1253
|
z & {
|
|
1254
1254
|
display: block;
|
|
1255
1255
|
}
|
data/test/sass/util_test.rb
CHANGED
|
@@ -159,12 +159,6 @@ class UtilTest < Test::Unit::TestCase
|
|
|
159
159
|
enum_cons(%w[foo bar baz], 2).map {|s1, s2| "#{s1}#{s2}"})
|
|
160
160
|
end
|
|
161
161
|
|
|
162
|
-
def test_extract
|
|
163
|
-
arr = [1, 2, 3, 4, 5]
|
|
164
|
-
assert_equal([1, 3, 5], extract!(arr) {|e| e % 2 == 1})
|
|
165
|
-
assert_equal([2, 4], arr)
|
|
166
|
-
end
|
|
167
|
-
|
|
168
162
|
def test_ord
|
|
169
163
|
assert_equal(102, ord("f"))
|
|
170
164
|
assert_equal(98, ord("bar"))
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sass
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 592302945
|
|
5
5
|
prerelease: 6
|
|
6
6
|
segments:
|
|
7
7
|
- 3
|
|
8
8
|
- 2
|
|
9
9
|
- 0
|
|
10
10
|
- alpha
|
|
11
|
-
-
|
|
12
|
-
version: 3.2.0.alpha.
|
|
11
|
+
- 62
|
|
12
|
+
version: 3.2.0.alpha.62
|
|
13
13
|
platform: ruby
|
|
14
14
|
authors:
|
|
15
15
|
- Nathan Weizenbaum
|
|
@@ -19,7 +19,7 @@ autorequire:
|
|
|
19
19
|
bindir: bin
|
|
20
20
|
cert_chain: []
|
|
21
21
|
|
|
22
|
-
date: 2012-
|
|
22
|
+
date: 2012-01-22 00:00:00 -05:00
|
|
23
23
|
default_executable:
|
|
24
24
|
dependencies:
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
@@ -86,7 +86,7 @@ files:
|
|
|
86
86
|
- lib/sass/logger.rb
|
|
87
87
|
- lib/sass/logger/base.rb
|
|
88
88
|
- lib/sass/logger/log_level.rb
|
|
89
|
-
- lib/sass/
|
|
89
|
+
- lib/sass/media.rb
|
|
90
90
|
- lib/sass/plugin.rb
|
|
91
91
|
- lib/sass/plugin/compiler.rb
|
|
92
92
|
- lib/sass/plugin/configuration.rb
|
|
@@ -163,7 +163,7 @@ files:
|
|
|
163
163
|
- lib/sass/tree/warn_node.rb
|
|
164
164
|
- lib/sass/tree/while_node.rb
|
|
165
165
|
- lib/sass/tree/trace_node.rb
|
|
166
|
-
- lib/sass/
|
|
166
|
+
- lib/sass/util.rb
|
|
167
167
|
- lib/sass/util/multibyte_string_scanner.rb
|
|
168
168
|
- lib/sass/util/subset_map.rb
|
|
169
169
|
- lib/sass/version.rb
|
|
@@ -239,7 +239,7 @@ files:
|
|
|
239
239
|
- test/sass/results/import_charset.css
|
|
240
240
|
- test/sass/results/import_charset_1_8.css
|
|
241
241
|
- test/sass/results/import_charset_ibm866.css
|
|
242
|
-
- test/sass/results/
|
|
242
|
+
- test/sass/results/import_content.css
|
|
243
243
|
- test/sass/results/line_numbers.css
|
|
244
244
|
- test/sass/results/mixins.css
|
|
245
245
|
- test/sass/results/multiline.css
|
|
@@ -247,13 +247,13 @@ files:
|
|
|
247
247
|
- test/sass/results/options.css
|
|
248
248
|
- test/sass/results/parent_ref.css
|
|
249
249
|
- test/sass/results/script.css
|
|
250
|
+
- test/sass/results/scss_import.css
|
|
250
251
|
- test/sass/results/scss_importee.css
|
|
251
252
|
- test/sass/results/subdir/nested_subdir/nested_subdir.css
|
|
252
253
|
- test/sass/results/subdir/subdir.css
|
|
253
254
|
- test/sass/results/units.css
|
|
254
255
|
- test/sass/results/warn.css
|
|
255
256
|
- test/sass/results/warn_imported.css
|
|
256
|
-
- test/sass/results/import_content.css
|
|
257
257
|
- test/sass/script_conversion_test.rb
|
|
258
258
|
- test/sass/script_test.rb
|
|
259
259
|
- test/sass/scss/css_test.rb
|
|
@@ -262,7 +262,7 @@ files:
|
|
|
262
262
|
- test/sass/scss/test_helper.rb
|
|
263
263
|
- test/sass/templates/_imported_charset_ibm866.sass
|
|
264
264
|
- test/sass/templates/_imported_charset_utf8.sass
|
|
265
|
-
- test/sass/templates/
|
|
265
|
+
- test/sass/templates/_imported_content.sass
|
|
266
266
|
- test/sass/templates/_partial.sass
|
|
267
267
|
- test/sass/templates/alt.sass
|
|
268
268
|
- test/sass/templates/basic.sass
|
|
@@ -277,9 +277,10 @@ files:
|
|
|
277
277
|
- test/sass/templates/expanded.sass
|
|
278
278
|
- test/sass/templates/if.sass
|
|
279
279
|
- test/sass/templates/import.sass
|
|
280
|
+
- test/sass/templates/import_charset.sass
|
|
280
281
|
- test/sass/templates/import_charset_1_8.sass
|
|
281
282
|
- test/sass/templates/import_charset_ibm866.sass
|
|
282
|
-
- test/sass/templates/
|
|
283
|
+
- test/sass/templates/import_content.sass
|
|
283
284
|
- test/sass/templates/importee.less
|
|
284
285
|
- test/sass/templates/importee.sass
|
|
285
286
|
- test/sass/templates/line_numbers.sass
|
|
@@ -305,7 +306,6 @@ files:
|
|
|
305
306
|
- test/sass/templates/units.sass
|
|
306
307
|
- test/sass/templates/warn.sass
|
|
307
308
|
- test/sass/templates/warn_imported.sass
|
|
308
|
-
- test/sass/templates/import_content.sass
|
|
309
309
|
- test/sass/test_helper.rb
|
|
310
310
|
- test/sass/util/multibyte_string_scanner_test.rb
|
|
311
311
|
- test/sass/util/subset_map_test.rb
|