crass 1.0.5 → 1.0.6

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
  SHA256:
3
- metadata.gz: 335330d4d7d855e20733747cc6f01cf3513c176c37dd107c473f525b94c2bbfc
4
- data.tar.gz: aec721d58cd3f1017fc957f7ae9d8b47f0e811db22649535ab64da580a6db70f
3
+ metadata.gz: def285e9f3d16e7222dce13f004b8ad8b936c76ecec909306cf15078f6ec8999
4
+ data.tar.gz: 6fbb08644b3ff290d66012bbfa9afa249ab565f9e67240e13d433715d1b535b7
5
5
  SHA512:
6
- metadata.gz: df7fc13c7c363a4aaf44986f62eabbce1fe9da744797bdcdf3148628d1c8447e69c24b6df2b33325bebe88951e195ccb43c9a5e50b2e1e920fab782aa5f532dc
7
- data.tar.gz: 38cfc577fcd184f175ba37b54f7e8638086a4c9817eb54c24b1c53a62f0437d4e97f9b87b8e81422511bf20c5eb2452f85838c6f822b89634fa944211eab3071
6
+ metadata.gz: 43daba64a022574e3ac4b439c5dca3cc329e2217e47df9eeaf79987748fa949feeaccb4745a212ebb9e91f01d4b5ec433947b57380efda233d078a9f1f1ea8ab
7
+ data.tar.gz: aa88544b1374fa5fb774970e5b714e6913c23e750a0e84767548e9c8076d25851f9f8861b38dfef0c9262a8c7785bce82436ad19c951ea4a9836fcee4a163199
data/HISTORY.md CHANGED
@@ -1,12 +1,19 @@
1
1
  Crass Change History
2
2
  ====================
3
3
 
4
- 1.0.5 (2019-10-15)
4
+ 1.0.6 (2020-01-12)
5
5
  ------------------
6
6
 
7
- * Removed test files from the gem. [@t-richards - #8][8]
7
+ * Number values are now limited to a maximum of `Float::MAX` and a minimum of
8
+ negative `Float::MAX`. (#11)
9
+
10
+ * Added project metadata to the gemspec. (#9 - @orien)
11
+
12
+
13
+ 1.0.5 (2019-10-15)
14
+ ------------------
8
15
 
9
- [8]:https://github.com/rgrove/crass/pull/8
16
+ * Removed test files from the gem. (#8 - @t-richards)
10
17
 
11
18
 
12
19
  1.0.4 (2018-04-08)
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017 Ryan Grove (ryan@wonko.com)
1
+ Copyright (c) 2020 Ryan Grove (ryan@wonko.com)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the ‘Software’), to deal in
data/README.md CHANGED
@@ -190,25 +190,3 @@ tokenizing and parsing rules that Crass implements.
190
190
  [simon]:http://exyr.org/about/
191
191
  [spec]:http://www.w3.org/TR/css-syntax-3/
192
192
  [tab]:http://www.xanthir.com/contact/
193
-
194
- License
195
- -------
196
-
197
- Copyright (c) 2017 Ryan Grove (ryan@wonko.com)
198
-
199
- Permission is hereby granted, free of charge, to any person obtaining a copy of
200
- this software and associated documentation files (the ‘Software’), to deal in
201
- the Software without restriction, including without limitation the rights to
202
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
203
- the Software, and to permit persons to whom the Software is furnished to do so,
204
- subject to the following conditions:
205
-
206
- The above copyright notice and this permission notice shall be included in all
207
- copies or substantial portions of the Software.
208
-
209
- THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
210
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
211
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
212
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
213
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
214
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -11,6 +11,13 @@ Gem::Specification.new do |s|
11
11
  s.homepage = 'https://github.com/rgrove/crass/'
12
12
  s.license = 'MIT'
13
13
 
14
+ s.metadata = {
15
+ 'bug_tracker_uri' => 'https://github.com/rgrove/crass/issues',
16
+ 'changelog_uri' => "https://github.com/rgrove/crass/blob/v#{s.version}/HISTORY.md",
17
+ 'documentation_uri' => "https://www.rubydoc.info/gems/crass/#{s.version}",
18
+ 'source_code_uri' => "https://github.com/rgrove/crass/tree/v#{s.version}",
19
+ }
20
+
14
21
  s.platform = Gem::Platform::RUBY
15
22
  s.required_ruby_version = Gem::Requirement.new('>= 1.9.2')
16
23
 
@@ -429,27 +429,36 @@ module Crass
429
429
  # 4.3.3. http://dev.w3.org/csswg/css-syntax/#consume-a-numeric-token
430
430
  def consume_numeric
431
431
  number = consume_number
432
+ repr = number[0]
433
+ value = number[1]
434
+ type = number[2]
435
+
436
+ if type == :integer
437
+ value = value.to_i
438
+ else
439
+ value = value.to_f
440
+ end
432
441
 
433
442
  if start_identifier?(@s.peek(3))
434
443
  create_token(:dimension,
435
- :repr => number[0],
436
- :type => number[2],
437
- :unit => consume_name,
438
- :value => number[1])
444
+ :repr => repr,
445
+ :type => type,
446
+ :unit => consume_name,
447
+ :value => value)
439
448
 
440
449
  elsif @s.peek == '%'
441
450
  @s.consume
442
451
 
443
452
  create_token(:percentage,
444
- :repr => number[0],
445
- :type => number[2],
446
- :value => number[1])
453
+ :repr => repr,
454
+ :type => type,
455
+ :value => value)
447
456
 
448
457
  else
449
458
  create_token(:number,
450
- :repr => number[0],
451
- :type => number[2],
452
- :value => number[1])
459
+ :repr => repr,
460
+ :type => type,
461
+ :value => value)
453
462
  end
454
463
  end
455
464
 
@@ -588,9 +597,19 @@ module Crass
588
597
  t = matches[:exponent_sign] == '-' ? -1 : 1
589
598
  e = matches[:exponent].to_i
590
599
 
591
- # I know this looks nutty, but it's exactly what's defined in the spec,
592
- # and it works.
593
- s * (i + f * 10**-d) * 10**(t * e)
600
+ # I know this formula looks nutty, but it's exactly what's defined in the
601
+ # spec, and it works.
602
+ value = s * (i + f * 10**-d) * 10**(t * e)
603
+
604
+ # Maximum and minimum values aren't defined in the spec, but are enforced
605
+ # here for sanity.
606
+ if value > Float::MAX
607
+ value = Float::MAX
608
+ elsif value < -Float::MAX
609
+ value = -Float::MAX
610
+ end
611
+
612
+ value
594
613
  end
595
614
 
596
615
  # Creates and returns a new token with the given _properties_.
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Crass
4
- VERSION = '1.0.5'
4
+ VERSION = '1.0.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Grove
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-16 00:00:00.000000000 Z
11
+ date: 2020-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -63,7 +63,11 @@ files:
63
63
  homepage: https://github.com/rgrove/crass/
64
64
  licenses:
65
65
  - MIT
66
- metadata: {}
66
+ metadata:
67
+ bug_tracker_uri: https://github.com/rgrove/crass/issues
68
+ changelog_uri: https://github.com/rgrove/crass/blob/v1.0.6/HISTORY.md
69
+ documentation_uri: https://www.rubydoc.info/gems/crass/1.0.6
70
+ source_code_uri: https://github.com/rgrove/crass/tree/v1.0.6
67
71
  post_install_message:
68
72
  rdoc_options: []
69
73
  require_paths: