css_parser 1.4.8 → 1.4.9

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: f5f0a57b79a2c3074f6e8a4f83f9c33c86af5f8d
4
- data.tar.gz: 70c358a8a37da0b69c7a752fdf845f5b57decaa4
3
+ metadata.gz: e52722a5c36a9f9c005952eec5a578dea6b0bcab
4
+ data.tar.gz: 7402ed19b5d47e7eaee3de93fd40b5f0919d040c
5
5
  SHA512:
6
- metadata.gz: c3cb1b5bff4cf81a54a3f2ed091b8119c6c47ec3e3278e110ac2ead3da8685d7504f2affeb62d8956128c165fe1273b3c89ed25c23e18722215f0e66293d9b5a
7
- data.tar.gz: 179f6d26055efe2340cbebc9bb551000cbe466dadae3c16ceb00708b8f3f7283f364d89d164e3509ae70d65c3c4e17d431a95627acc250411d5ab89685f44f95
6
+ metadata.gz: 3bb6fe5419e7eed4020270f70450fad376f21d950974b0bdc24625f0073221a304fa01ca73f628504d7cfa4fbbbf6eb683fe9855e46c362e337ed2db701fb265
7
+ data.tar.gz: 659b96cce569d009fe41c00073f05c214afb278c8e4fc2834c8b05cd5af8f1fd1477f52e065b8de96e8148931f8fd4b5f44f5c53dc376bf27db5608cb690bd25
@@ -20,7 +20,7 @@ module CssParser
20
20
  STRIP_HTML_COMMENTS_RX = /\<\!\-\-|\-\-\>/m
21
21
 
22
22
  # Initial parsing
23
- RE_AT_IMPORT_RULE = /\@import\s*(?:url\s*)?(?:\()?(?:\s*)["']?([^'"\s\)]*)["']?\)?([\w\s\,^\]\(\))]*)\)?[;\n]?/
23
+ RE_AT_IMPORT_RULE = /\@import\s*(?:url\s*)?(?:\()?(?:\s*)["']?([^'"\s\)]*)["']?\)?([\w\s\,^\]\(\)]*)\)?[;\n]?/
24
24
 
25
25
  MAX_REDIRECTS = 3
26
26
 
@@ -188,10 +188,10 @@ module CssParser
188
188
  end
189
189
 
190
190
  # Output all CSS rules as a Hash
191
- def to_h(media_types = :all)
191
+ def to_h(which_media = :all)
192
192
  out = {}
193
193
  styles_by_media_types = {}
194
- each_selector(media_types) do |selectors, declarations, specificity, media_types|
194
+ each_selector(which_media) do |selectors, declarations, specificity, media_types|
195
195
  media_types.each do |media_type|
196
196
  styles_by_media_types[media_type] ||= []
197
197
  styles_by_media_types[media_type] << [selectors, declarations]
@@ -221,10 +221,10 @@ module CssParser
221
221
  end
222
222
 
223
223
  # Output all CSS rules as a single stylesheet.
224
- def to_s(media_types = :all)
224
+ def to_s(which_media = :all)
225
225
  out = ''
226
226
  styles_by_media_types = {}
227
- each_selector(media_types) do |selectors, declarations, specificity, media_types|
227
+ each_selector(which_media) do |selectors, declarations, specificity, media_types|
228
228
  media_types.each do |media_type|
229
229
  styles_by_media_types[media_type] ||= []
230
230
  styles_by_media_types[media_type] << [selectors, declarations]
@@ -511,8 +511,8 @@ module CssParser
511
511
  raise RemoteFileError if @options[:io_exceptions]
512
512
  return '', nil
513
513
  elsif res.code.to_i >= 300 and res.code.to_i < 400
514
- if res.response['Location'] != nil
515
- return read_remote_file Addressable::URI.parse(URI.escape(res.response['Location']))
514
+ if res['Location'] != nil
515
+ return read_remote_file Addressable::URI.parse(Addressable::URI.escape(res['Location']))
516
516
  end
517
517
  end
518
518
 
@@ -23,7 +23,7 @@ module CssParser
23
23
  RE_GRADIENT = /[-a-z]*gradient\([-a-z0-9 .,#%()]*\)/im
24
24
 
25
25
  # Initial parsing
26
- RE_AT_IMPORT_RULE = /\@import[\s]+(url\()?["''"]?(.[^'"\s"']*)["''"]?\)?([\w\s\,^\])]*)\)?;?/
26
+ RE_AT_IMPORT_RULE = /\@import\s+(url\()?["']?(.[^'"\s]*)["']?\)?([\w\s\,^\])]*)\)?;?/
27
27
 
28
28
  #--
29
29
  #RE_AT_MEDIA_RULE = Regexp.new('(\"(.[^\n\r\f\\"]*|\\\\' + RE_NL.to_s + '|' + RE_ESCAPE.to_s + ')*\")')
@@ -44,7 +44,7 @@ module CssParser
44
44
  STRIP_HTML_COMMENTS_RX = /\<\!\-\-|\-\-\>/m
45
45
 
46
46
  # Special units
47
- BOX_MODEL_UNITS_RX = /(auto|inherit|0|([\-]*([0-9]+|[0-9]*\.[0-9]+)(e[mx]+|px|[cm]+m|p[tc+]|in|\%)))([\s;]|\Z)/imx
47
+ BOX_MODEL_UNITS_RX = /(auto|inherit|0|([\-]*([0-9]+|[0-9]*\.[0-9]+)(rem|vw|vh|vm|vmin|vmax|e[mx]+|px|[cm]+m|p[tc+]|in|\%)))([\s;]|\Z)/imx
48
48
  RE_LENGTH_OR_PERCENTAGE = Regexp.new('([\-]*(([0-9]*\.[0-9]+)|[0-9]+)(e[mx]+|px|[cm]+m|p[tc+]|in|\%))', Regexp::IGNORECASE)
49
49
  RE_BACKGROUND_POSITION = Regexp.new("((((#{RE_LENGTH_OR_PERCENTAGE})|left|center|right|top|bottom)[\s]*){1,2})", Regexp::IGNORECASE | Regexp::EXTENDED)
50
50
  RE_BACKGROUND_SIZE = Regexp.new("\\s*/\\s*((((#{RE_LENGTH_OR_PERCENTAGE})|auto|cover|contain|initial|inherit)[\\s]*){1,2})", Regexp::IGNORECASE | Regexp::EXTENDED)
@@ -1,3 +1,3 @@
1
1
  module CssParser
2
- VERSION = "1.4.8".freeze
2
+ VERSION = "1.4.9".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.8
4
+ version: 1.4.9
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-03 00:00:00.000000000 Z
11
+ date: 2017-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable