sass 3.2.0.alpha.244 → 3.2.0.alpha.247
Sign up to get free protection for your applications and to get access to all the features.
- data/REVISION +1 -1
- data/VERSION +1 -1
- data/lib/sass/engine.rb +3 -3
- data/lib/sass/media.rb +58 -138
- data/lib/sass/scss/parser.rb +12 -9
- data/lib/sass/tree/css_import_node.rb +12 -4
- data/lib/sass/tree/media_node.rb +14 -4
- data/lib/sass/tree/visitors/convert.rb +2 -2
- data/lib/sass/tree/visitors/cssize.rb +1 -1
- data/lib/sass/tree/visitors/perform.rb +4 -4
- data/lib/sass/tree/visitors/set_options.rb +6 -1
- data/lib/sass/util.rb +1 -1
- data/test/sass/cache_test.rb +2 -2
- data/test/sass/callbacks_test.rb +1 -1
- data/test/sass/conversion_test.rb +22 -2
- data/test/sass/css2sass_test.rb +1 -1
- data/test/sass/engine_test.rb +2 -2
- data/test/sass/extend_test.rb +1 -1
- data/test/sass/functions_test.rb +1 -1
- data/test/sass/importer_test.rb +2 -2
- data/test/sass/less_conversion_test.rb +1 -1
- data/test/sass/logger_test.rb +1 -1
- data/test/sass/plugin_test.rb +2 -2
- data/test/sass/script_conversion_test.rb +1 -1
- data/test/sass/script_test.rb +1 -1
- data/test/sass/scss/css_test.rb +5 -1
- data/test/sass/scss/rx_test.rb +1 -1
- data/test/sass/scss/scss_test.rb +26 -1
- data/test/sass/scss/test_helper.rb +1 -1
- data/test/sass/util/multibyte_string_scanner_test.rb +1 -1
- data/test/sass/util/subset_map_test.rb +1 -1
- data/test/sass/util_test.rb +1 -1
- metadata +5 -5
data/REVISION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
5cc7590756da94e5c6df3da3be9ca8ff946d7279
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.0.alpha.
|
1
|
+
3.2.0.alpha.247
|
data/lib/sass/engine.rb
CHANGED
@@ -705,7 +705,7 @@ WARNING
|
|
705
705
|
Tree::CharsetNode.new(name)
|
706
706
|
when 'media'
|
707
707
|
parser = Sass::SCSS::Parser.new(value, @options[:filename], @line)
|
708
|
-
Tree::MediaNode.new(parser.parse_media_query_list)
|
708
|
+
Tree::MediaNode.new(parser.parse_media_query_list.to_a)
|
709
709
|
else
|
710
710
|
Tree::DirectiveNode.new(
|
711
711
|
value.nil? ? ["@#{directive}"] : ["@#{directive} "] + parse_interp(value, offset))
|
@@ -800,7 +800,7 @@ WARNING
|
|
800
800
|
str = script_parser.parse_string
|
801
801
|
media_parser = Sass::SCSS::Parser.new(scanner, @options[:filename], @line)
|
802
802
|
media = media_parser.parse_media_query_list
|
803
|
-
return Tree::CssImportNode.new(str, media)
|
803
|
+
return Tree::CssImportNode.new(str, media.to_a)
|
804
804
|
end
|
805
805
|
|
806
806
|
unless str = scanner.scan(Sass::SCSS::RX::STRING)
|
@@ -812,7 +812,7 @@ WARNING
|
|
812
812
|
if !scanner.match?(/[,;]|$/)
|
813
813
|
media_parser = Sass::SCSS::Parser.new(scanner, @options[:filename], @line)
|
814
814
|
media = media_parser.parse_media_query_list
|
815
|
-
Tree::CssImportNode.new(str || uri, media)
|
815
|
+
Tree::CssImportNode.new(str || uri, media.to_a)
|
816
816
|
elsif val =~ /^http:\/\//
|
817
817
|
Tree::CssImportNode.new("url(#{val})")
|
818
818
|
else
|
data/lib/sass/media.rb
CHANGED
@@ -14,16 +14,6 @@ module Sass::Media
|
|
14
14
|
@queries = queries
|
15
15
|
end
|
16
16
|
|
17
|
-
# Runs the SassScript in the media query list.
|
18
|
-
#
|
19
|
-
# @yield [interp] A block that should perform interpolation.
|
20
|
-
# @yieldparam interp [Array<String, Sass::Script::Node>]
|
21
|
-
# An interpolation array to perform.
|
22
|
-
# @yieldreturn [String] The interpolated value.
|
23
|
-
def perform(&run_interp)
|
24
|
-
@queries.each {|q| q.perform(&run_interp)}
|
25
|
-
end
|
26
|
-
|
27
17
|
# Merges this query list with another. The returned query list
|
28
18
|
# queries for the intersection between the two inputs.
|
29
19
|
#
|
@@ -52,19 +42,22 @@ module Sass::Media
|
|
52
42
|
queries.map {|q| q.to_src(options)}.join(', ')
|
53
43
|
end
|
54
44
|
|
45
|
+
# Returns a representation of the query as an array of strings and
|
46
|
+
# potentially {Sass::Script::Node}s (if there's interpolation in it). When
|
47
|
+
# the interpolation is resolved and the strings are joined together, this
|
48
|
+
# will be the string representation of this query.
|
49
|
+
#
|
50
|
+
# @return [Array<String, Sass::Script::Node>]
|
51
|
+
def to_a
|
52
|
+
Sass::Util.intersperse(queries.map {|q| q.to_a}, ', ').flatten
|
53
|
+
end
|
54
|
+
|
55
55
|
# Returns a deep copy of this query list and all its children.
|
56
56
|
#
|
57
57
|
# @return [QueryList]
|
58
58
|
def deep_copy
|
59
59
|
QueryList.new(queries.map {|q| q.deep_copy})
|
60
60
|
end
|
61
|
-
|
62
|
-
# Sets the options hash for the script nodes in the media query.
|
63
|
-
#
|
64
|
-
# @param options [{Symbol => Object}] The options has to set.
|
65
|
-
def options=(options)
|
66
|
-
queries.each {|q| q.options = options}
|
67
|
-
end
|
68
61
|
end
|
69
62
|
|
70
63
|
# A single media query.
|
@@ -73,50 +66,51 @@ module Sass::Media
|
|
73
66
|
class Query
|
74
67
|
# The modifier for the query.
|
75
68
|
#
|
69
|
+
# When parsed as Sass code, this contains strings and SassScript nodes. When
|
70
|
+
# parsed as CSS, it contains a single string (accessible via
|
71
|
+
# \{#resolved_modifier}).
|
72
|
+
#
|
76
73
|
# @return [Array<String, Sass::Script::Node>]
|
77
74
|
attr_accessor :modifier
|
78
75
|
|
79
|
-
# The modifier for the query after any SassScript has been resolved.
|
80
|
-
# Only set once \{Tree::Visitors::Perform} has been run.
|
81
|
-
#
|
82
|
-
# @return [String]
|
83
|
-
attr_accessor :resolved_modifier
|
84
|
-
|
85
76
|
# The type of the query (e.g. `"screen"` or `"print"`).
|
86
77
|
#
|
78
|
+
# When parsed as Sass code, this contains strings and SassScript nodes. When
|
79
|
+
# parsed as CSS, it contains a single string (accessible via
|
80
|
+
# \{#resolved_type}).
|
81
|
+
#
|
87
82
|
# @return [Array<String, Sass::Script::Node>]
|
88
83
|
attr_accessor :type
|
89
84
|
|
90
|
-
# The type of the query after any SassScript has been resolved.
|
91
|
-
# Only set once \{Tree::Visitors::Perform} has been run.
|
92
|
-
#
|
93
|
-
# @return [String]
|
94
|
-
attr_accessor :resolved_type
|
95
|
-
|
96
85
|
# The trailing expressions in the query.
|
97
86
|
#
|
98
|
-
#
|
87
|
+
# When parsed as Sass code, each expression contains strings and SassScript
|
88
|
+
# nodes. When parsed as CSS, each one contains a single string.
|
89
|
+
#
|
90
|
+
# @return [Array<Array<String, Sass::Script::Node>>]
|
99
91
|
attr_accessor :expressions
|
100
92
|
|
101
93
|
# @param modifier [Array<String, Sass::Script::Node>] See \{#modifier}
|
102
94
|
# @param type [Array<String, Sass::Script::Node>] See \{#type}
|
103
|
-
# @param expressions [Array<
|
95
|
+
# @param expressions [Array<Array<String, Sass::Script::Node>>] See \{#expressions}
|
104
96
|
def initialize(modifier, type, expressions)
|
105
97
|
@modifier = modifier
|
106
98
|
@type = type
|
107
99
|
@expressions = expressions
|
108
100
|
end
|
109
101
|
|
110
|
-
#
|
111
|
-
#
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
102
|
+
# See \{#modifier}.
|
103
|
+
# @return [String]
|
104
|
+
def resolved_modifier
|
105
|
+
# modifier should contain only a single string
|
106
|
+
modifier.first || ''
|
107
|
+
end
|
108
|
+
|
109
|
+
# See \{#type}.
|
110
|
+
# @return [String]
|
111
|
+
def resolved_type
|
112
|
+
# type should contain only a single string
|
113
|
+
type.first || ''
|
120
114
|
end
|
121
115
|
|
122
116
|
# Merges this query with another. The returned query queries for
|
@@ -147,8 +141,8 @@ module Sass::Media
|
|
147
141
|
mod = m1.empty? ? m2 : m1
|
148
142
|
end
|
149
143
|
q = Query.new([], [], other.expressions + expressions)
|
150
|
-
q.
|
151
|
-
q.
|
144
|
+
q.type = [type]
|
145
|
+
q.modifier = [mod]
|
152
146
|
return q
|
153
147
|
end
|
154
148
|
|
@@ -161,7 +155,12 @@ module Sass::Media
|
|
161
155
|
css << ' ' unless resolved_modifier.empty?
|
162
156
|
css << resolved_type
|
163
157
|
css << ' and ' unless resolved_type.empty? || expressions.empty?
|
164
|
-
css << expressions.map
|
158
|
+
css << expressions.map do |e|
|
159
|
+
# It's possible for there to be script nodes in Expressions even when
|
160
|
+
# we're converting to CSS in the case where we parsed the document as
|
161
|
+
# CSS originally (as in css_test.rb).
|
162
|
+
e.map {|c| c.is_a?(Sass::Script::Node) ? c.to_sass : c.to_s}.join
|
163
|
+
end.join(' and ')
|
165
164
|
css
|
166
165
|
end
|
167
166
|
|
@@ -175,10 +174,23 @@ module Sass::Media
|
|
175
174
|
src << ' ' unless modifier.empty?
|
176
175
|
src << Sass::Media._interp_to_src(type, options)
|
177
176
|
src << ' and ' unless type.empty? || expressions.empty?
|
178
|
-
src << expressions.map
|
177
|
+
src << expressions.map do |e|
|
178
|
+
Sass::Media._interp_to_src(e, options)
|
179
|
+
end.join(' and ')
|
179
180
|
src
|
180
181
|
end
|
181
182
|
|
183
|
+
# @see \{MediaQuery#to\_a}
|
184
|
+
def to_a
|
185
|
+
res = []
|
186
|
+
res += modifier
|
187
|
+
res << ' ' unless modifier.empty?
|
188
|
+
res += type
|
189
|
+
res << ' and ' unless type.empty? || expressions.empty?
|
190
|
+
res += Sass::Util.intersperse(expressions, ' and ').flatten
|
191
|
+
res
|
192
|
+
end
|
193
|
+
|
182
194
|
# Returns a deep copy of this query and all its children.
|
183
195
|
#
|
184
196
|
# @return [Query]
|
@@ -186,99 +198,7 @@ module Sass::Media
|
|
186
198
|
Query.new(
|
187
199
|
modifier.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c},
|
188
200
|
type.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c},
|
189
|
-
expressions.map {|
|
190
|
-
end
|
191
|
-
|
192
|
-
# Sets the options hash for the script nodes in the media query.
|
193
|
-
#
|
194
|
-
# @param options [{Symbol => Object}] The options has to set.
|
195
|
-
def options=(options)
|
196
|
-
modifier.each {|m| m.options = options if m.is_a?(Sass::Script::Node)}
|
197
|
-
type.each {|t| t.options = options if t.is_a?(Sass::Script::Node)}
|
198
|
-
expressions.each {|e| e.options = options}
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
# A media query expression.
|
203
|
-
#
|
204
|
-
# '(' S* media_feature S* [ ':' S* expr ]? ')'
|
205
|
-
class Expression
|
206
|
-
# The name of the feature being queried for.
|
207
|
-
#
|
208
|
-
# @return [Sass::Script::Node]
|
209
|
-
attr_accessor :name
|
210
|
-
|
211
|
-
# The name of the feature after any SassScript has been resolved.
|
212
|
-
# Only set once \{Tree::Visitors::Perform} has been run.
|
213
|
-
#
|
214
|
-
# @return [String]
|
215
|
-
attr_accessor :resolved_name
|
216
|
-
|
217
|
-
# The value of the feature.
|
218
|
-
#
|
219
|
-
# @return [Sass::Script::Node]
|
220
|
-
attr_accessor :value
|
221
|
-
|
222
|
-
# The value of the feature after any SassScript has been resolved.
|
223
|
-
# Only set once \{Tree::Visitors::Perform} has been run.
|
224
|
-
#
|
225
|
-
# @return [String]
|
226
|
-
attr_accessor :resolved_value
|
227
|
-
|
228
|
-
# @param name [Sass::Script::Node] See \{#name}
|
229
|
-
# @param value [Sass::Script::Node] See \{#value}
|
230
|
-
def initialize(name, value)
|
231
|
-
@name = name
|
232
|
-
@value = value
|
233
|
-
end
|
234
|
-
|
235
|
-
# Runs the SassScript in the expression.
|
236
|
-
#
|
237
|
-
# @yield [interp] A block that should perform interpolation.
|
238
|
-
# @yieldparam interp [Array<String, Sass::Script::Node>]
|
239
|
-
# An interpolation array to perform.
|
240
|
-
# @yieldreturn [String] The interpolated value.
|
241
|
-
def perform
|
242
|
-
@resolved_name = yield name ? [name] : []
|
243
|
-
@resolved_value = yield value ? [value] : []
|
244
|
-
end
|
245
|
-
|
246
|
-
# Returns the CSS for the expression.
|
247
|
-
#
|
248
|
-
# @return [String]
|
249
|
-
def to_css
|
250
|
-
css = '('
|
251
|
-
css << resolved_name
|
252
|
-
css << ': ' << resolved_value unless resolved_value.empty?
|
253
|
-
css << ')'
|
254
|
-
css
|
255
|
-
end
|
256
|
-
|
257
|
-
# Returns the Sass/SCSS code for the expression.
|
258
|
-
#
|
259
|
-
# @param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}).
|
260
|
-
# @return [String]
|
261
|
-
def to_src(options)
|
262
|
-
src = '('
|
263
|
-
src << name.to_sass(options)
|
264
|
-
src << ': ' << value.to_sass(options) if value
|
265
|
-
src << ')'
|
266
|
-
src
|
267
|
-
end
|
268
|
-
|
269
|
-
# Returns a deep copy of this expression.
|
270
|
-
#
|
271
|
-
# @return [Expression]
|
272
|
-
def deep_copy
|
273
|
-
Expression.new(name.deep_copy, value && value.deep_copy)
|
274
|
-
end
|
275
|
-
|
276
|
-
# Sets the options hash for the script nodes in the expression.
|
277
|
-
#
|
278
|
-
# @param options [{Symbol => Object}] The options has to set.
|
279
|
-
def options=(options)
|
280
|
-
name.options = options
|
281
|
-
value.options = options if value
|
201
|
+
expressions.map {|e| e.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c}})
|
282
202
|
end
|
283
203
|
end
|
284
204
|
|
data/lib/sass/scss/parser.rb
CHANGED
@@ -309,7 +309,7 @@ module Sass
|
|
309
309
|
str = sass_script(:parse_string)
|
310
310
|
media = media_query_list
|
311
311
|
ss
|
312
|
-
return node(Tree::CssImportNode.new(str, media))
|
312
|
+
return node(Tree::CssImportNode.new(str, media.to_a))
|
313
313
|
end
|
314
314
|
|
315
315
|
path = @scanner[1] || @scanner[2]
|
@@ -317,7 +317,7 @@ module Sass
|
|
317
317
|
|
318
318
|
media = media_query_list
|
319
319
|
if path =~ /^http:\/\// || media || use_css_import?
|
320
|
-
return node(Sass::Tree::CssImportNode.new(str, media))
|
320
|
+
return node(Sass::Tree::CssImportNode.new(str, media.to_a))
|
321
321
|
end
|
322
322
|
|
323
323
|
node(Sass::Tree::ImportNode.new(path.strip))
|
@@ -326,7 +326,7 @@ module Sass
|
|
326
326
|
def use_css_import?; false; end
|
327
327
|
|
328
328
|
def media_directive
|
329
|
-
block(node(Sass::Tree::MediaNode.new(media_query_list)), :directive)
|
329
|
+
block(node(Sass::Tree::MediaNode.new(media_query_list.to_a)), :directive)
|
330
330
|
end
|
331
331
|
|
332
332
|
# http://www.w3.org/TR/css3-mediaqueries/#syntax
|
@@ -378,17 +378,20 @@ module Sass
|
|
378
378
|
end
|
379
379
|
|
380
380
|
def media_expr
|
381
|
+
interp = interpolation and return interp
|
381
382
|
return unless tok(/\(/)
|
383
|
+
res = ['(']
|
382
384
|
ss
|
383
|
-
|
385
|
+
res << sass_script(:parse)
|
384
386
|
|
385
387
|
if tok(/:/)
|
386
|
-
|
388
|
+
res << ': '
|
389
|
+
ss
|
390
|
+
res << sass_script(:parse)
|
387
391
|
end
|
388
|
-
tok!(/\)/)
|
392
|
+
res << tok!(/\)/)
|
389
393
|
ss
|
390
|
-
|
391
|
-
Sass::Media::Expression.new(name, value)
|
394
|
+
res
|
392
395
|
end
|
393
396
|
|
394
397
|
def charset_directive
|
@@ -724,7 +727,7 @@ module Sass
|
|
724
727
|
val = interp_ident || expr!(:interp_string)
|
725
728
|
ss
|
726
729
|
end
|
727
|
-
tok(/\]/)
|
730
|
+
tok!(/\]/)
|
728
731
|
|
729
732
|
Selector::Attribute.new(merge(name), merge(ns), op, merge(val))
|
730
733
|
end
|
@@ -15,13 +15,21 @@ module Sass::Tree
|
|
15
15
|
# @return [String]
|
16
16
|
attr_accessor :resolved_uri
|
17
17
|
|
18
|
-
# The media query,
|
18
|
+
# The media query for this rule, interspersed with {Sass::Script::Node}s
|
19
|
+
# representing `#{}`-interpolation. Any adjacent strings will be merged
|
20
|
+
# together.
|
19
21
|
#
|
20
|
-
# @return [Sass::
|
22
|
+
# @return [Array<String, Sass::Script::Node>]
|
21
23
|
attr_accessor :query
|
22
24
|
|
25
|
+
# The media query for this rule, without any unresolved interpolation. It's
|
26
|
+
# only set once {Tree::Node#perform} has been called.
|
27
|
+
#
|
28
|
+
# @return [Sass::Media::QueryList]
|
29
|
+
attr_accessor :resolved_query
|
30
|
+
|
23
31
|
# @param uri [String, Sass::Script::Node] See \{#uri}
|
24
|
-
# @param query [Sass::
|
32
|
+
# @param query [Array<String, Sass::Script::Node>] See \{#query}
|
25
33
|
def initialize(uri, query = nil)
|
26
34
|
@uri = uri
|
27
35
|
@query = query
|
@@ -44,7 +52,7 @@ module Sass::Tree
|
|
44
52
|
@resolved_value ||=
|
45
53
|
begin
|
46
54
|
str = "@import #{resolved_uri}"
|
47
|
-
str << " #{
|
55
|
+
str << " #{resolved_query.to_css}" if resolved_query
|
48
56
|
str
|
49
57
|
end
|
50
58
|
end
|
data/lib/sass/tree/media_node.rb
CHANGED
@@ -6,18 +6,28 @@ module Sass::Tree
|
|
6
6
|
#
|
7
7
|
# @see Sass::Tree
|
8
8
|
class MediaNode < DirectiveNode
|
9
|
-
#
|
9
|
+
# TODO: parse and cache the query immediately if it has no dynamic elements
|
10
|
+
|
11
|
+
# The media query for this rule, interspersed with {Sass::Script::Node}s
|
12
|
+
# representing `#{}`-interpolation. Any adjacent strings will be merged
|
13
|
+
# together.
|
10
14
|
#
|
11
|
-
# @return [Sass::
|
15
|
+
# @return [Array<String, Sass::Script::Node>]
|
12
16
|
attr_accessor :query
|
13
17
|
|
18
|
+
# The media query for this rule, without any unresolved interpolation. It's
|
19
|
+
# only set once {Tree::Node#perform} has been called.
|
20
|
+
#
|
21
|
+
# @return [Sass::Media::QueryList]
|
22
|
+
attr_accessor :resolved_query
|
23
|
+
|
14
24
|
# @see RuleNode#tabs
|
15
25
|
attr_accessor :tabs
|
16
26
|
|
17
27
|
# @see RuleNode#group_end
|
18
28
|
attr_accessor :group_end
|
19
29
|
|
20
|
-
# @param query [Sass::
|
30
|
+
# @param query [Array<String, Sass::Script::Node>] See \{#query}
|
21
31
|
def initialize(query)
|
22
32
|
@query = query
|
23
33
|
@tabs = 0
|
@@ -32,7 +42,7 @@ module Sass::Tree
|
|
32
42
|
|
33
43
|
# @see DirectiveNode#resolved_value
|
34
44
|
def resolved_value
|
35
|
-
@resolved_value ||= "@media #{
|
45
|
+
@resolved_value ||= "@media #{resolved_query.to_css}"
|
36
46
|
end
|
37
47
|
|
38
48
|
# True when the directive has no visible children.
|
@@ -148,7 +148,7 @@ class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def visit_media(node)
|
151
|
-
"#{tab_str}@media #{node.query
|
151
|
+
"#{tab_str}@media #{interp_to_src(node.query)}#{yield}"
|
152
152
|
end
|
153
153
|
|
154
154
|
def visit_supports(node)
|
@@ -161,7 +161,7 @@ class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
|
|
161
161
|
else
|
162
162
|
str = "#{tab_str}@import #{node.uri}"
|
163
163
|
end
|
164
|
-
str << " #{node.query
|
164
|
+
str << " #{interp_to_src(node.query)}" unless node.query.empty?
|
165
165
|
"#{str}#{semi}\n"
|
166
166
|
end
|
167
167
|
|
@@ -139,7 +139,7 @@ class Sass::Tree::Visitors::Cssize < Sass::Tree::Visitors::Base
|
|
139
139
|
yield unless bubble(node)
|
140
140
|
media = node.children.select {|c| c.is_a?(Sass::Tree::MediaNode)}
|
141
141
|
node.children.reject! {|c| c.is_a?(Sass::Tree::MediaNode)}
|
142
|
-
media = media.select {|n| n.
|
142
|
+
media = media.select {|n| n.resolved_query = n.resolved_query.merge(node.resolved_query)}
|
143
143
|
(node.children.empty? ? [] : [node]) + media
|
144
144
|
end
|
145
145
|
|
@@ -298,8 +298,8 @@ END
|
|
298
298
|
end
|
299
299
|
|
300
300
|
def visit_media(node)
|
301
|
-
node.query
|
302
|
-
node.
|
301
|
+
parser = Sass::SCSS::StaticParser.new(run_interp(node.query), node.filename, node.line)
|
302
|
+
node.resolved_query ||= parser.parse_media_query_list
|
303
303
|
yield
|
304
304
|
end
|
305
305
|
|
@@ -312,8 +312,8 @@ END
|
|
312
312
|
def visit_cssimport(node)
|
313
313
|
node.resolved_uri = run_interp([node.uri])
|
314
314
|
if node.query
|
315
|
-
node.query
|
316
|
-
node.
|
315
|
+
parser = Sass::SCSS::StaticParser.new(run_interp(node.query), node.filename, node.line)
|
316
|
+
node.resolved_query ||= parser.parse_media_query_list
|
317
317
|
end
|
318
318
|
yield
|
319
319
|
end
|
@@ -101,7 +101,12 @@ class Sass::Tree::Visitors::SetOptions < Sass::Tree::Visitors::Base
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def visit_media(node)
|
104
|
-
node.query.options = @options
|
104
|
+
node.query.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)}
|
105
|
+
yield
|
106
|
+
end
|
107
|
+
|
108
|
+
def visit_cssimport(node)
|
109
|
+
node.query.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)} if node.query
|
105
110
|
yield
|
106
111
|
end
|
107
112
|
|
data/lib/sass/util.rb
CHANGED
@@ -591,7 +591,7 @@ MSG
|
|
591
591
|
Regexp.new(/\A(?:#{_enc("\uFEFF", e)})?#{
|
592
592
|
_enc('@charset "', e)}(.*?)#{_enc('"', e)}|\A(#{
|
593
593
|
_enc("\uFEFF", e)})/)
|
594
|
-
rescue Encoding::
|
594
|
+
rescue Encoding::ConverterNotFoundError => _
|
595
595
|
nil # JRuby on Java 5 doesn't support UTF-32
|
596
596
|
rescue
|
597
597
|
# /\A@charset "(.*?)"/
|
data/test/sass/cache_test.rb
CHANGED
data/test/sass/callbacks_test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'test_helper'
|
2
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
3
3
|
|
4
4
|
class ConversionTest < Test::Unit::TestCase
|
5
5
|
def test_basic
|
@@ -1153,7 +1153,17 @@ SCSS
|
|
1153
1153
|
end
|
1154
1154
|
|
1155
1155
|
def test_media_with_expressions
|
1156
|
-
|
1156
|
+
# TODO: get rid of the #{} in the expression output
|
1157
|
+
assert_sass_to_scss <<SCSS, <<SASS
|
1158
|
+
$media1: screen;
|
1159
|
+
$media2: print;
|
1160
|
+
$var: -webkit-min-device-pixel-ratio;
|
1161
|
+
$val: 20;
|
1162
|
+
|
1163
|
+
@media \#{$media1} and (\#{$var + "-foo"}: \#{$val + 5}), only \#{$media2} {
|
1164
|
+
a: b;
|
1165
|
+
}
|
1166
|
+
SCSS
|
1157
1167
|
$media1: screen
|
1158
1168
|
$media2: print
|
1159
1169
|
$var: -webkit-min-device-pixel-ratio
|
@@ -1162,6 +1172,16 @@ $val: 20
|
|
1162
1172
|
@media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2}
|
1163
1173
|
a: b
|
1164
1174
|
SASS
|
1175
|
+
|
1176
|
+
assert_scss_to_sass <<SASS, <<SCSS
|
1177
|
+
$media1: screen
|
1178
|
+
$media2: print
|
1179
|
+
$var: -webkit-min-device-pixel-ratio
|
1180
|
+
$val: 20
|
1181
|
+
|
1182
|
+
@media \#{$media1} and (\#{$var + "-foo"}: \#{$val + 5}), only \#{$media2}
|
1183
|
+
a: b
|
1184
|
+
SASS
|
1165
1185
|
$media1: screen;
|
1166
1186
|
$media2: print;
|
1167
1187
|
$var: -webkit-min-device-pixel-ratio;
|
data/test/sass/css2sass_test.rb
CHANGED
data/test/sass/engine_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
-
require 'test_helper'
|
4
|
-
require '
|
3
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
4
|
+
require File.dirname(__FILE__) + '/test_helper'
|
5
5
|
require 'sass/engine'
|
6
6
|
require 'stringio'
|
7
7
|
require 'mock_importer'
|
data/test/sass/extend_test.rb
CHANGED
data/test/sass/functions_test.rb
CHANGED
data/test/sass/importer_test.rb
CHANGED
data/test/sass/logger_test.rb
CHANGED
data/test/sass/plugin_test.rb
CHANGED
data/test/sass/script_test.rb
CHANGED
data/test/sass/scss/css_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
-
require '
|
3
|
+
require File.dirname(__FILE__) + '/test_helper'
|
4
4
|
require 'sass/scss/css_parser'
|
5
5
|
|
6
6
|
# These tests just test the parsing of CSS
|
@@ -957,6 +957,10 @@ SCSS
|
|
957
957
|
|
958
958
|
## Regressions
|
959
959
|
|
960
|
+
def test_selector_without_closing_bracket
|
961
|
+
assert_not_parses('"]"', "foo[bar <err>{a: b}")
|
962
|
+
end
|
963
|
+
|
960
964
|
def test_closing_line_comment_end_with_compact_output
|
961
965
|
assert_equal(<<CSS, render(<<SCSS, :style => :compact))
|
962
966
|
/* foo */
|
data/test/sass/scss/rx_test.rb
CHANGED
data/test/sass/scss/scss_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
-
require
|
3
|
+
require File.dirname(__FILE__) + '/test_helper'
|
4
4
|
|
5
5
|
class ScssTest < Test::Unit::TestCase
|
6
6
|
include ScssTestHelper
|
@@ -936,6 +936,31 @@ $vals: 1 2 3;
|
|
936
936
|
SCSS
|
937
937
|
end
|
938
938
|
|
939
|
+
def test_media_interpolation_with_reparse
|
940
|
+
assert_equal <<CSS, render(<<SCSS)
|
941
|
+
@media screen and (max-width: 300px) {
|
942
|
+
a: b; }
|
943
|
+
@media screen and (max-width: 300px) {
|
944
|
+
a: b; }
|
945
|
+
@media screen and (max-width: 300px) {
|
946
|
+
a: b; }
|
947
|
+
@media screen and (max-width: 300px), print and (max-width: 300px) {
|
948
|
+
a: b; }
|
949
|
+
CSS
|
950
|
+
$constraint: "(max-width: 300px)";
|
951
|
+
$fragment: "nd \#{$constraint}";
|
952
|
+
$comma: "een, pri";
|
953
|
+
@media screen and \#{$constraint} {a: b}
|
954
|
+
@media screen {
|
955
|
+
@media \#{$constraint} {a: b}
|
956
|
+
}
|
957
|
+
@media screen a\#{$fragment} {a: b}
|
958
|
+
@media scr\#{$comma}nt {
|
959
|
+
@media \#{$constraint} {a: b}
|
960
|
+
}
|
961
|
+
SCSS
|
962
|
+
end
|
963
|
+
|
939
964
|
def test_moz_document_interpolation
|
940
965
|
assert_equal <<CSS, render(<<SCSS)
|
941
966
|
@-moz-document url(http://sass-lang.com/),
|
data/test/sass/util_test.rb
CHANGED
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: 592302835
|
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
|
+
- 247
|
12
|
+
version: 3.2.0.alpha.247
|
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-06-15 00:00:00 -04:00
|
23
23
|
default_executable:
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- lib/sass/tree/content_node.rb
|
155
155
|
- lib/sass/tree/css_import_node.rb
|
156
156
|
- lib/sass/tree/variable_node.rb
|
157
|
+
- lib/sass/tree/warn_node.rb
|
157
158
|
- lib/sass/tree/visitors/base.rb
|
158
159
|
- lib/sass/tree/visitors/check_nesting.rb
|
159
160
|
- lib/sass/tree/visitors/convert.rb
|
@@ -163,7 +164,6 @@ files:
|
|
163
164
|
- lib/sass/tree/visitors/perform.rb
|
164
165
|
- lib/sass/tree/visitors/set_options.rb
|
165
166
|
- lib/sass/tree/visitors/to_css.rb
|
166
|
-
- lib/sass/tree/warn_node.rb
|
167
167
|
- lib/sass/tree/while_node.rb
|
168
168
|
- lib/sass/tree/supports_node.rb
|
169
169
|
- lib/sass/tree/trace_node.rb
|