premailer 1.16.0 → 1.18.0

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: c5569e920c965e583c48c9f8501b77b951c73d07c9be2f922ab4924dc1166871
4
- data.tar.gz: a8a665fe6ec7ba543b53ca24869e3c73bbf793cb003e4d27e4f854523309b605
3
+ metadata.gz: b4a7dce51bfedaef59c17b84a78c74af9dbd6af2a32ae2e64bbb8105346a152e
4
+ data.tar.gz: cc17465063476f728e4dd1308909dfd0c240b32f53d250dafa307da7b1fde01a
5
5
  SHA512:
6
- metadata.gz: 3dc465f0f358d41f34ceef3c35fceda64f18d0b3e6ef27497dd649f4ce775c37a52d0f7ff12e5702e67ba6dc59760cedc5c706e8194a0b3063c9215644299f76
7
- data.tar.gz: 78aa6ffd3c33aabc6eab536d09c4f00bb5a775e32db01b3445aa96530af1a1d950760de0cc99609008dd0d1af01d6976eacd298fb4acb705005070faa7c4c747
6
+ metadata.gz: a402ccb956b7c663190ac6adffdfe56ed38352e58a1dd599d5f1999f7417aeae4e3f820bc1745b32c937be5334b3046fb6fd64be9b42d6dd362b847c49f0ac12
7
+ data.tar.gz: f9ce454c789ad0082b98bc246cfd055a27d24e2dad37edf95921595ae30c377151f713877c346573a55ac13236fcadfa8912035d3e7efd4cd525b07df5959745
@@ -63,8 +63,12 @@ class Premailer
63
63
 
64
64
  declarations = []
65
65
  style.scan(/\[SPEC\=([\d]+)\[(.[^\]\]]*)\]\]/).each do |declaration|
66
- rs = CssParser::RuleSet.new(nil, declaration[1].to_s, declaration[0].to_i)
67
- declarations << rs
66
+ begin
67
+ rs = CssParser::RuleSet.new(nil, declaration[1].to_s, declaration[0].to_i)
68
+ declarations << rs
69
+ rescue ArgumentError => e
70
+ raise e if @options[:rule_set_exceptions]
71
+ end
68
72
  end
69
73
 
70
74
  # Perform style folding
@@ -168,7 +168,8 @@ class Premailer
168
168
  # @option options [Boolean] :preserve_reset Whether to preserve styles associated with the MailChimp reset code. Default is true.
169
169
  # @option options [Boolean] :with_html_string Whether the html param should be treated as a raw string. Default is false.
170
170
  # @option options [Boolean] :verbose Whether to print errors and warnings to <tt>$stderr</tt>. Default is false.
171
- # @option options [Boolean] :io_exceptions Throws exceptions on I/O errors.
171
+ # @option options [Boolean] :io_exceptions Throws exceptions on I/O errors. Default is false.
172
+ # @option options [Boolean] :rule_set_exceptions Throws exceptions on invalid values in CSS Parser rule sets. Default is true.
172
173
  # @option options [Boolean] :include_link_tags Whether to include css from <tt>link rel=stylesheet</tt> tags. Default is true.
173
174
  # @option options [Boolean] :include_style_tags Whether to include css from <tt>style</tt> tags. Default is true.
174
175
  # @option options [String] :input_encoding Manually specify the source documents encoding. This is a good idea. Default is ASCII-8BIT.
@@ -200,6 +201,7 @@ class Premailer
200
201
  :verbose => false,
201
202
  :debug => false,
202
203
  :io_exceptions => false,
204
+ :rule_set_exceptions => true,
203
205
  :include_link_tags => true,
204
206
  :include_style_tags => true,
205
207
  :input_encoding => 'ASCII-8BIT',
@@ -233,7 +235,8 @@ class Premailer
233
235
  @css_parser = CssParser::Parser.new({
234
236
  :absolute_paths => true,
235
237
  :import => true,
236
- :io_exceptions => @options[:io_exceptions]
238
+ :io_exceptions => @options[:io_exceptions],
239
+ :rule_set_exceptions => @options[:rule_set_exceptions]
237
240
  })
238
241
 
239
242
  @adapter_class = Adapter.find @options[:adapter]
@@ -504,7 +507,8 @@ public
504
507
 
505
508
  # Check <tt>CLIENT_SUPPORT_FILE</tt> for any CSS warnings
506
509
  def check_client_support # :nodoc:
507
- @client_support ||= YAML::load(File.open(CLIENT_SUPPORT_FILE))
510
+ kwargs = RUBY_VERSION >= "3.1.0" ? { aliases: true } : {}
511
+ @client_support ||= YAML::load(File.open(CLIENT_SUPPORT_FILE), **kwargs)
508
512
 
509
513
  warnings = []
510
514
  properties = []
@@ -1,4 +1,4 @@
1
1
  class Premailer
2
2
  # Premailer version.
3
- VERSION = '1.16.0'.freeze
3
+ VERSION = '1.18.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: premailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dunae
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-04 00:00:00.000000000 Z
11
+ date: 2022-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: css_parser
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.0
19
+ version: 1.12.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.0
26
+ version: 1.12.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: htmlentities
29
29
  requirement: !ruby/object:Gem::Requirement