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 +4 -4
- data/HISTORY.md +10 -3
- data/LICENSE +1 -1
- data/README.md +0 -22
- data/crass.gemspec +7 -0
- data/lib/crass/tokenizer.rb +32 -13
- data/lib/crass/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: def285e9f3d16e7222dce13f004b8ad8b936c76ecec909306cf15078f6ec8999
|
4
|
+
data.tar.gz: 6fbb08644b3ff290d66012bbfa9afa249ab565f9e67240e13d433715d1b535b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
4
|
+
1.0.6 (2020-01-12)
|
5
5
|
------------------
|
6
6
|
|
7
|
-
*
|
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
|
-
|
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
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.
|
data/crass.gemspec
CHANGED
@@ -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
|
|
data/lib/crass/tokenizer.rb
CHANGED
@@ -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
|
436
|
-
:type
|
437
|
-
:unit
|
438
|
-
:value =>
|
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
|
445
|
-
:type
|
446
|
-
:value =>
|
453
|
+
:repr => repr,
|
454
|
+
:type => type,
|
455
|
+
:value => value)
|
447
456
|
|
448
457
|
else
|
449
458
|
create_token(:number,
|
450
|
-
:repr
|
451
|
-
:type
|
452
|
-
:value =>
|
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
|
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_.
|
data/lib/crass/version.rb
CHANGED
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.
|
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:
|
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:
|