css_parser 1.4.9 → 1.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/css_parser/parser.rb +4 -5
- data/lib/css_parser/rule_set.rb +11 -6
- data/lib/css_parser/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b445faf1396f058086f3ec3654d5ebb4a2d1157
|
4
|
+
data.tar.gz: 2c8b069bfff50b3e5072ba4912d52aff2ec813ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95c649943ddeb1d61395107986d97d594354654647d13453c41c7cee0d2bffeb6645320e2084a56609131f29721f3f7ddb538ed2c068af43770e48947b1fee40
|
7
|
+
data.tar.gz: ed26582b08c72abf29c10c8f6a45d28c5d8a12cadbaf9dd3096ff96f719251b0334d73ad68b1cb56fc3e489d184fbe53d3bc7cd24fd595d93e4f76f94b1b6250
|
data/lib/css_parser/parser.rb
CHANGED
@@ -399,7 +399,7 @@ module CssParser
|
|
399
399
|
|
400
400
|
opts[:base_uri] = uri if opts[:base_uri].nil?
|
401
401
|
|
402
|
-
src,
|
402
|
+
src, = read_remote_file(uri) # skip charset
|
403
403
|
if src
|
404
404
|
add_block!(src, opts)
|
405
405
|
end
|
@@ -483,9 +483,8 @@ module CssParser
|
|
483
483
|
|
484
484
|
src = '', charset = nil
|
485
485
|
|
486
|
+
uri = Addressable::URI.parse(uri.to_s)
|
486
487
|
begin
|
487
|
-
uri = Addressable::URI.parse(uri.to_s)
|
488
|
-
|
489
488
|
if uri.scheme == 'file'
|
490
489
|
# local file
|
491
490
|
fh = open(uri.path, 'rb')
|
@@ -508,7 +507,7 @@ module CssParser
|
|
508
507
|
|
509
508
|
if res.code.to_i >= 400
|
510
509
|
@redirect_count = nil
|
511
|
-
raise RemoteFileError if @options[:io_exceptions]
|
510
|
+
raise RemoteFileError.new(uri.to_s) if @options[:io_exceptions]
|
512
511
|
return '', nil
|
513
512
|
elsif res.code.to_i >= 300 and res.code.to_i < 400
|
514
513
|
if res['Location'] != nil
|
@@ -536,7 +535,7 @@ module CssParser
|
|
536
535
|
end
|
537
536
|
rescue
|
538
537
|
@redirect_count = nil
|
539
|
-
raise RemoteFileError
|
538
|
+
raise RemoteFileError.new(uri.to_s)if @options[:io_exceptions]
|
540
539
|
return nil, nil
|
541
540
|
end
|
542
541
|
|
data/lib/css_parser/rule_set.rb
CHANGED
@@ -317,14 +317,19 @@ module CssParser
|
|
317
317
|
# Combine several properties into a shorthand one
|
318
318
|
def create_shorthand_properties! properties, shorthand_property # :nodoc:
|
319
319
|
values = []
|
320
|
+
properties_to_delete = []
|
320
321
|
properties.each do |property|
|
321
|
-
|
322
|
+
if @declarations.has_key?(property) and not @declarations[property][:is_important]
|
322
323
|
values << @declarations[property][:value]
|
323
|
-
|
324
|
-
|
325
|
-
|
324
|
+
properties_to_delete << property
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
if values.length > 1
|
329
|
+
properties_to_delete.each do |property|
|
330
|
+
@declarations.delete(property)
|
331
|
+
end
|
326
332
|
|
327
|
-
unless values.empty?
|
328
333
|
@declarations[shorthand_property] = {:value => values.join(' ')}
|
329
334
|
end
|
330
335
|
end
|
@@ -493,7 +498,7 @@ module CssParser
|
|
493
498
|
continuation = decs + ';'
|
494
499
|
|
495
500
|
elsif matches = decs.match(/(.[^:]*)\s*:\s*(.+)(;?\s*\Z)/i)
|
496
|
-
property, value,
|
501
|
+
property, value, = matches.captures # skip end_of_declaration
|
497
502
|
|
498
503
|
add_declaration!(property, value)
|
499
504
|
continuation = ''
|
data/lib/css_parser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: css_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dunae
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|