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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e52722a5c36a9f9c005952eec5a578dea6b0bcab
4
- data.tar.gz: 7402ed19b5d47e7eaee3de93fd40b5f0919d040c
3
+ metadata.gz: 1b445faf1396f058086f3ec3654d5ebb4a2d1157
4
+ data.tar.gz: 2c8b069bfff50b3e5072ba4912d52aff2ec813ee
5
5
  SHA512:
6
- metadata.gz: 3bb6fe5419e7eed4020270f70450fad376f21d950974b0bdc24625f0073221a304fa01ca73f628504d7cfa4fbbbf6eb683fe9855e46c362e337ed2db701fb265
7
- data.tar.gz: 659b96cce569d009fe41c00073f05c214afb278c8e4fc2834c8b05cd5af8f1fd1477f52e065b8de96e8148931f8fd4b5f44f5c53dc376bf27db5608cb690bd25
6
+ metadata.gz: 95c649943ddeb1d61395107986d97d594354654647d13453c41c7cee0d2bffeb6645320e2084a56609131f29721f3f7ddb538ed2c068af43770e48947b1fee40
7
+ data.tar.gz: ed26582b08c72abf29c10c8f6a45d28c5d8a12cadbaf9dd3096ff96f719251b0334d73ad68b1cb56fc3e489d184fbe53d3bc7cd24fd595d93e4f76f94b1b6250
@@ -399,7 +399,7 @@ module CssParser
399
399
 
400
400
  opts[:base_uri] = uri if opts[:base_uri].nil?
401
401
 
402
- src, charset = read_remote_file(uri)
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 if @options[:io_exceptions]
538
+ raise RemoteFileError.new(uri.to_s)if @options[:io_exceptions]
540
539
  return nil, nil
541
540
  end
542
541
 
@@ -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
- if @declarations.has_key?(property) and not @declarations[property][:is_important]
322
+ if @declarations.has_key?(property) and not @declarations[property][:is_important]
322
323
  values << @declarations[property][:value]
323
- @declarations.delete(property)
324
- end
325
- end
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, end_of_declaration = matches.captures
501
+ property, value, = matches.captures # skip end_of_declaration
497
502
 
498
503
  add_declaration!(property, value)
499
504
  continuation = ''
@@ -1,3 +1,3 @@
1
1
  module CssParser
2
- VERSION = "1.4.9".freeze
2
+ VERSION = "1.4.10".freeze
3
3
  end
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.9
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-02-22 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable