sass 3.4.11 → 3.4.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b356808a261bfc58ed1ea2a65e975f5b64d8048
4
- data.tar.gz: c2f0bc6dbd4e8332eed0e0f6e60dad6a79d47797
3
+ metadata.gz: f4b73da7dd6f9103e68b1edcb10a59411db18295
4
+ data.tar.gz: ac1d03b3da377814ef33bc5ef9e8f58f318571f9
5
5
  SHA512:
6
- metadata.gz: c0631122d887b7d410c5fd38dcedd9487ae78e1d22e2f7a5a4be4557d9c1ad40ab55643e590eff2b23a3b3dfecac61057086cfe926015d09e60ee8d1e7abbadb
7
- data.tar.gz: 8208ef88dc5a7a6b13493c8a00542587419525fdf980fcd616ff19ec83b39388e1322c5f21f61147eb9f2cd059f5659acf3476ae552abcc5d290cc9563d6caf3
6
+ metadata.gz: 4da9bdb240ed324d5e7ffd69c3f84d78d811060f19949c4c1d534bf71fbce21b87b96e976f80c6f21fe5636d31e2472f9132fc12b9cb82370bd251e1c3f3e8ec
7
+ data.tar.gz: 6adddaf3a218472b3eaf4f8a23c6a909dab474f8265088aedee06cbdc6505d948a50d6f29aca9464f9d6786c7f6db3f6f89eaa435a329cddf1bec407a516027f
@@ -0,0 +1,3 @@
1
+ Contributions are welcomed. Please see the following sites for guidelines:
2
+
3
+ [http://sass-lang.com/community#Contribute](http://sass-lang.com/community#Contribute)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.4.11
1
+ 3.4.12
@@ -1 +1 @@
1
- 31 January 2015 02:49:50 UTC
1
+ 14 February 2015 01:18:18 UTC
@@ -1471,10 +1471,10 @@ MESSAGE
1471
1471
  assert_type insert, :String, :insert
1472
1472
  assert_integer index, :index
1473
1473
  assert_unit index, nil, :index
1474
- insertion_point = if index.value > 0
1475
- [index.value - 1, original.value.size].min
1474
+ insertion_point = if index.to_i > 0
1475
+ [index.to_i - 1, original.value.size].min
1476
1476
  else
1477
- [index.value, -original.value.size - 1].max
1477
+ [index.to_i, -original.value.size - 1].max
1478
1478
  end
1479
1479
  result = original.value.dup.insert(insertion_point, insert.value)
1480
1480
  Sass::Script::Value::String.new(result, original.type)
@@ -2325,10 +2325,10 @@ MESSAGE
2325
2325
  generator = Sass::Script::Functions.random_number_generator
2326
2326
  if limit
2327
2327
  assert_integer limit, "limit"
2328
- if limit.value < 1
2328
+ if limit.to_i < 1
2329
2329
  raise ArgumentError.new("$limit #{limit} must be greater than or equal to 1")
2330
2330
  end
2331
- number(1 + generator.rand(limit.value))
2331
+ number(1 + generator.rand(limit.to_i))
2332
2332
  else
2333
2333
  number(generator.rand)
2334
2334
  end
@@ -198,7 +198,8 @@ module Sass
198
198
 
199
199
  # @return [Boolean] Whether or not there's more source text to lex.
200
200
  def done?
201
- whitespace unless after_interpolation? && @interpolation_stack.last
201
+ return if @next_tok
202
+ whitespace unless after_interpolation? && !@interpolation_stack.empty?
202
203
  @scanner.eos? && @tok.nil?
203
204
  end
204
205
 
@@ -235,6 +236,11 @@ module Sass
235
236
  private
236
237
 
237
238
  def read_token
239
+ if (tok = @next_tok)
240
+ @next_tok = nil
241
+ return tok
242
+ end
243
+
238
244
  return if done?
239
245
  start_pos = source_position
240
246
  value = token
@@ -293,9 +299,9 @@ MESSAGE
293
299
  end
294
300
 
295
301
  if @scanner[2] == '#{' # '
296
- @scanner.pos -= 2 # Don't actually consume the #{
297
- @offset -= 2
298
302
  @interpolation_stack << [:string, re]
303
+ start_pos = Sass::Source::Position.new(@line, @offset - 2)
304
+ @next_tok = Token.new(:string_interpolation, range(start_pos), @scanner.pos - 2)
299
305
  end
300
306
  str =
301
307
  if re == :uri
@@ -392,9 +398,9 @@ MESSAGE
392
398
  else
393
399
  raise "[BUG] Unreachable" unless @scanner[1] == '#{' # '
394
400
  str.slice!(-2..-1)
395
- @scanner.pos -= 2 # Don't actually consume the #{
396
- @offset -= 2
397
401
  @interpolation_stack << [:special_fun, parens]
402
+ start_pos = Sass::Source::Position.new(@line, @offset - 2)
403
+ @next_tok = Token.new(:string_interpolation, range(start_pos), @scanner.pos - 2)
398
404
  end
399
405
 
400
406
  return [:special_fun, Sass::Script::Value::String.new(str)]
@@ -419,11 +425,8 @@ MESSAGE
419
425
  op = scan(REGULAR_EXPRESSIONS[:op])
420
426
  return unless op
421
427
  name = OPERATORS[op]
422
- if name == :begin_interpolation && !@interpolation_stack.empty?
423
- [:string_interpolation]
424
- else
425
- [name]
426
- end
428
+ @interpolation_stack << nil if name == :begin_interpolation
429
+ [name]
427
430
  end
428
431
 
429
432
  def raw(rx)
@@ -1664,6 +1664,14 @@ SCSS
1664
1664
  assert_error_message("Expected $limit to be an integer but got 1.5 for `random'", "random(1.5)")
1665
1665
  end
1666
1666
 
1667
+ # Regression test for #1638.
1668
+ def test_random_with_float_integer_limit
1669
+ result = perform("random(1.0)")
1670
+ assert_kind_of Sass::Script::Number, result
1671
+ assert result.value >= 0, "Random number was below 0"
1672
+ assert result.value <= 1, "Random number was above 1"
1673
+ end
1674
+
1667
1675
  # This could *possibly* fail, but exceedingly unlikely
1668
1676
  def test_random_is_semi_unique
1669
1677
  if Sass::Script::Functions.instance_variable_defined?("@random_number_generator")
@@ -206,6 +206,13 @@ class SassScriptTest < MiniTest::Test
206
206
  assert_equal "foo1bar5baz4bang", resolve('\'foo#{1 + "bar#{2 + 3}baz" + 4}bang\'')
207
207
  end
208
208
 
209
+ def test_interpolation_in_interpolation
210
+ assert_equal 'foo', resolve('#{#{foo}}')
211
+ assert_equal 'foo', resolve('"#{#{foo}}"')
212
+ assert_equal 'foo', resolve('#{"#{foo}"}')
213
+ assert_equal 'foo', resolve('"#{"#{foo}"}"')
214
+ end
215
+
209
216
  def test_interpolation_with_newline
210
217
  assert_equal "\nbang", resolve('"#{"\a "}bang"')
211
218
  assert_equal "\n\nbang", resolve('"#{"\a "}\a bang"')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.11
4
+ version: 3.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natalie Weizenbaum
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-01-31 00:00:00.000000000 Z
13
+ date: 2015-02-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: yard
@@ -68,7 +68,7 @@ extensions: []
68
68
  extra_rdoc_files: []
69
69
  files:
70
70
  - .yardopts
71
- - CONTRIBUTING
71
+ - CONTRIBUTING.md
72
72
  - MIT-LICENSE
73
73
  - README.md
74
74
  - REVISION
@@ -1,3 +0,0 @@
1
- Contributions are welcomed. Please see the following sites for guidelines:
2
-
3
- http://sass-lang.com/community#Contribute