sass 3.2.0.alpha.91 → 3.2.0.alpha.93

Sign up to get free protection for your applications and to get access to all the features.
data/REVISION CHANGED
@@ -1 +1 @@
1
- 0f20305d2c2cff846f830634070e60bdb790e903
1
+ f19a88c02e1ac7a174ad2ada5cab276a5084fb2e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.0.alpha.91
1
+ 3.2.0.alpha.93
@@ -171,9 +171,9 @@ module Sass::Media
171
171
  # @return [String]
172
172
  def to_src(options)
173
173
  src = ''
174
- src << Sass::Media._interp_or_var_to_src(modifier, options)
174
+ src << Sass::Media._interp_to_src(modifier, options)
175
175
  src << ' ' unless modifier.empty?
176
- src << Sass::Media._interp_or_var_to_src(type, options)
176
+ src << Sass::Media._interp_to_src(type, options)
177
177
  src << ' and ' unless type.empty? || expressions.empty?
178
178
  src << expressions.map {|e| e.to_src(options)}.join(' and ')
179
179
  src
@@ -205,7 +205,7 @@ module Sass::Media
205
205
  class Expression
206
206
  # The name of the feature being queried for.
207
207
  #
208
- # @return [Array<String, Sass::Script::Node>]
208
+ # @return [Sass::Script::Node]
209
209
  attr_accessor :name
210
210
 
211
211
  # The name of the feature after any SassScript has been resolved.
@@ -225,7 +225,7 @@ module Sass::Media
225
225
  # @return [String]
226
226
  attr_accessor :resolved_value
227
227
 
228
- # @param name [Array<String, Sass::Script::Node>] See \{#name}
228
+ # @param name [Sass::Script::Node] See \{#name}
229
229
  # @param value [Sass::Script::Node] See \{#value}
230
230
  def initialize(name, value)
231
231
  @name = name
@@ -239,7 +239,7 @@ module Sass::Media
239
239
  # An interpolation array to perform.
240
240
  # @yieldreturn [String] The interpolated value.
241
241
  def perform
242
- @resolved_name = yield name
242
+ @resolved_name = yield name ? [name] : []
243
243
  @resolved_value = yield value ? [value] : []
244
244
  end
245
245
 
@@ -260,7 +260,7 @@ module Sass::Media
260
260
  # @return [String]
261
261
  def to_src(options)
262
262
  src = '('
263
- src << Sass::Media._interp_or_var_to_src(name, options)
263
+ src << name.to_sass(options)
264
264
  src << ': ' << value.to_sass(options) if value
265
265
  src << ')'
266
266
  src
@@ -270,28 +270,24 @@ module Sass::Media
270
270
  #
271
271
  # @return [Expression]
272
272
  def deep_copy
273
- Expression.new(
274
- name.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c},
275
- value && value.deep_copy)
273
+ Expression.new(name.deep_copy, value && value.deep_copy)
276
274
  end
277
275
 
278
276
  # Sets the options hash for the script nodes in the expression.
279
277
  #
280
278
  # @param options [{Symbol => Object}] The options has to set.
281
279
  def options=(options)
282
- name.each {|n| n.options = options if n.is_a?(Sass::Script::Node)}
280
+ name.options = options
283
281
  value.options = options if value
284
282
  end
285
283
  end
286
284
 
287
- # Converts an interpolation array that may represent a single variable to source.
285
+ # Converts an interpolation array to source.
288
286
  #
289
287
  # @param [Array<String, Sass::Script::Node>] The interpolation array to convert.
290
288
  # @param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}).
291
289
  # @return [String]
292
- def self._interp_or_var_to_src(interp, options)
293
- interp = interp.reject {|v| v.is_a?(String) && v.empty?}
294
- return interp[0].to_sass(options) if interp.length == 1 && interp[0].is_a?(Sass::Script::Variable)
290
+ def self._interp_to_src(interp, options)
295
291
  interp.map do |r|
296
292
  next r if r.is_a?(String)
297
293
  "\#{#{r.to_sass(options)}}"
@@ -344,9 +344,9 @@ module Sass
344
344
  end
345
345
 
346
346
  def media_query
347
- if ident1 = interp_ident_or_var
347
+ if ident1 = interp_ident
348
348
  ss
349
- ident2 = interp_ident_or_var
349
+ ident2 = interp_ident
350
350
  ss
351
351
  if ident2 && ident2.length == 1 && ident2[0].is_a?(String) && ident2[0].downcase == 'and'
352
352
  query = Sass::Media::Query.new([], ident1, [])
@@ -380,9 +380,7 @@ module Sass
380
380
  def media_expr
381
381
  return unless tok(/\(/)
382
382
  ss
383
- @expected = "media feature (e.g. min-device-width, color)"
384
- name = expr!(:interp_ident_or_var)
385
- ss
383
+ name = sass_script(:parse)
386
384
 
387
385
  if tok(/:/)
388
386
  ss; value = sass_script(:parse)
@@ -1163,14 +1163,14 @@ $baz: 12;
1163
1163
  SCSS
1164
1164
  end
1165
1165
 
1166
- def test_media_with_variables
1166
+ def test_media_with_expressions
1167
1167
  assert_renders <<SASS, <<SCSS
1168
1168
  $media1: screen
1169
1169
  $media2: print
1170
1170
  $var: -webkit-min-device-pixel-ratio
1171
1171
  $val: 20
1172
1172
 
1173
- @media $media1 and ($var: $val), only $media2
1173
+ @media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2}
1174
1174
  a: b
1175
1175
  SASS
1176
1176
  $media1: screen;
@@ -1178,7 +1178,7 @@ $media2: print;
1178
1178
  $var: -webkit-min-device-pixel-ratio;
1179
1179
  $val: 20;
1180
1180
 
1181
- @media $media1 and ($var: $val), only $media2 {
1181
+ @media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2} {
1182
1182
  a: b;
1183
1183
  }
1184
1184
  SCSS
@@ -634,12 +634,12 @@ SASS
634
634
 
635
635
  def test_import_with_dynamic_media_query
636
636
  assert_equal(<<CSS, render(<<SASS))
637
- @import "foo" print and (-webkit-min-device-pixel-ratio: 20);
637
+ @import "foo" print and (-webkit-min-device-pixel-ratio-foo: 25);
638
638
  CSS
639
639
  $media: print
640
640
  $key: -webkit-min-device-pixel-ratio
641
641
  $value: 20
642
- @import "foo" $media and ($key: $value)
642
+ @import "foo" \#{$media} and ($key + "-foo": $value + 5)
643
643
  SASS
644
644
  end
645
645
 
@@ -2227,14 +2227,14 @@ SASS
2227
2227
 
2228
2228
  def test_variables_in_media
2229
2229
  assert_equal <<CSS, render(<<SASS)
2230
- @media screen and (-webkit-min-device-pixel-ratio: 20), only print {
2230
+ @media screen and (-webkit-min-device-pixel-ratio-foo: 25), only print {
2231
2231
  a: b; }
2232
2232
  CSS
2233
2233
  $media1: screen
2234
2234
  $media2: print
2235
2235
  $var: -webkit-min-device-pixel-ratio
2236
2236
  $val: 20
2237
- @media $media1 and ($var: $val), only $media2
2237
+ @media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2}
2238
2238
  a: b
2239
2239
  SASS
2240
2240
  end
@@ -276,12 +276,12 @@ SCSS
276
276
 
277
277
  def test_dynamic_media_import
278
278
  assert_equal(<<CSS, render(<<SCSS))
279
- @import "foo" print and (-webkit-min-device-pixel-ratio: 20);
279
+ @import "foo" print and (-webkit-min-device-pixel-ratio-foo: 25);
280
280
  CSS
281
281
  $media: print;
282
282
  $key: -webkit-min-device-pixel-ratio;
283
283
  $value: 20;
284
- @import "foo" $media and ($key: $value);
284
+ @import "foo" \#{$media} and ($key + "-foo": $value + 5);
285
285
  SCSS
286
286
  end
287
287
 
@@ -914,7 +914,7 @@ $media1: screen;
914
914
  $media2: print;
915
915
  $var: -webkit-min-device-pixel-ratio;
916
916
  $val: 20;
917
- @media $media1 and ($var: $val), only $media2 {a: b}
917
+ @media \#{$media1} and ($var: $val), only \#{$media2} {a: b}
918
918
  SCSS
919
919
 
920
920
  assert_equal <<CSS, render(<<SCSS)
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: 592303019
4
+ hash: 592303015
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
9
  - 0
10
10
  - alpha
11
- - 91
12
- version: 3.2.0.alpha.91
11
+ - 93
12
+ version: 3.2.0.alpha.93
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-03-01 00:00:00 -05:00
22
+ date: 2012-03-09 00:00:00 -05:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -150,9 +150,7 @@ files:
150
150
  - lib/sass/tree/return_node.rb
151
151
  - lib/sass/tree/root_node.rb
152
152
  - lib/sass/tree/content_node.rb
153
- - lib/sass/tree/css_import_node.rb
154
153
  - lib/sass/tree/variable_node.rb
155
- - lib/sass/tree/warn_node.rb
156
154
  - lib/sass/tree/visitors/base.rb
157
155
  - lib/sass/tree/visitors/check_nesting.rb
158
156
  - lib/sass/tree/visitors/convert.rb
@@ -161,7 +159,9 @@ files:
161
159
  - lib/sass/tree/visitors/perform.rb
162
160
  - lib/sass/tree/visitors/set_options.rb
163
161
  - lib/sass/tree/visitors/to_css.rb
162
+ - lib/sass/tree/warn_node.rb
164
163
  - lib/sass/tree/while_node.rb
164
+ - lib/sass/tree/css_import_node.rb
165
165
  - lib/sass/tree/trace_node.rb
166
166
  - lib/sass/media.rb
167
167
  - lib/sass/util/multibyte_string_scanner.rb