premailer 1.18.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4a7dce51bfedaef59c17b84a78c74af9dbd6af2a32ae2e64bbb8105346a152e
4
- data.tar.gz: cc17465063476f728e4dd1308909dfd0c240b32f53d250dafa307da7b1fde01a
3
+ metadata.gz: 037056bb30a304387a4746310417cbf88c3efa7dc59901989334b6741b1199a7
4
+ data.tar.gz: 4e92b08924143d560f84f23ca117c29445a3c038d78c09ded7b5e9c0ba7af065
5
5
  SHA512:
6
- metadata.gz: a402ccb956b7c663190ac6adffdfe56ed38352e58a1dd599d5f1999f7417aeae4e3f820bc1745b32c937be5334b3046fb6fd64be9b42d6dd362b847c49f0ac12
7
- data.tar.gz: f9ce454c789ad0082b98bc246cfd055a27d24e2dad37edf95921595ae30c377151f713877c346573a55ac13236fcadfa8912035d3e7efd4cd525b07df5959745
6
+ metadata.gz: 6e628663bb621b3f5ae5a81855af90455c1ed9eeb6cd154df24d8641d831f617a2f6b5314079f05f4bbed475ea6e9cf1ce66cfa05f49a7d9b268494bb3282509
7
+ data.tar.gz: 3814f3e413553a54af47c95f21293e58a3a80547983e973deca7360cdaa86e0fe5eccf7abf2c0b67c99d174831ac16c07f384a1fbf5768cd03d7717218f37eae
@@ -73,7 +73,11 @@ class Premailer
73
73
 
74
74
  # Perform style folding
75
75
  merged = CssParser.merge(declarations)
76
- merged.expand_shorthand!
76
+ begin
77
+ merged.expand_shorthand!
78
+ rescue ArgumentError => e
79
+ raise e if @options[:rule_set_exceptions]
80
+ end
77
81
 
78
82
  # Duplicate CSS attributes as HTML attributes
79
83
  if Premailer::RELATED_ATTRIBUTES.has_key?(el.name) && @options[:css_to_attributes]
@@ -237,14 +241,7 @@ class Premailer
237
241
  thing.gsub! entity, replacement
238
242
  end
239
243
  end
240
- # Default encoding is ASCII-8BIT (binary) per http://groups.google.com/group/nokogiri-talk/msg/0b81ef0dc180dc74
241
- # However, we really don't want to hardcode this. ASCII-8BIT should be the default, but not the only option.
242
- encoding = if thing.is_a?(String) and RUBY_VERSION =~ /1.9/
243
- thing = thing.force_encoding(@options[:input_encoding]).encode!
244
- @options[:input_encoding]
245
- else
246
- @options[:input_encoding] || (RUBY_PLATFORM == 'java' ? nil : 'BINARY')
247
- end
244
+ encoding = @options[:input_encoding] || (RUBY_PLATFORM == 'java' ? nil : 'BINARY')
248
245
  doc = if @options[:html_fragment]
249
246
  ::Nokogiri::HTML.fragment(thing, encoding)
250
247
  else
@@ -237,14 +237,7 @@ class Premailer
237
237
  thing.gsub! entity, replacement
238
238
  end
239
239
  end
240
- # Default encoding is ASCII-8BIT (binary) per http://groups.google.com/group/nokogiri-talk/msg/0b81ef0dc180dc74
241
- # However, we really don't want to hardcode this. ASCII-8BIT should be the default, but not the only option.
242
- encoding = if thing.is_a?(String) and RUBY_VERSION =~ /1.9/
243
- thing = thing.force_encoding(@options[:input_encoding]).encode!
244
- @options[:input_encoding]
245
- else
246
- @options[:input_encoding] || (RUBY_PLATFORM == 'java' ? nil : 'BINARY')
247
- end
240
+ encoding = @options[:input_encoding] || (RUBY_PLATFORM == 'java' ? nil : 'BINARY')
248
241
  doc = if @options[:html_fragment]
249
242
  ::Nokogiri::HTML.fragment(thing, encoding)
250
243
  else
@@ -231,11 +231,6 @@ class Premailer
231
231
  thing.gsub! entity, replacement
232
232
  end
233
233
  end
234
- # Default encoding is ASCII-8BIT (binary) per http://groups.google.com/group/nokogiri-talk/msg/0b81ef0dc180dc74
235
- # However, we really don't want to hardcode this. ASCII-8BIT should be the default, but not the only option.
236
- if thing.is_a?(String) and RUBY_VERSION =~ /1.9/
237
- thing = thing.force_encoding(@options[:input_encoding]).encode!
238
- end
239
234
  doc = if @options[:html_fragment]
240
235
  ::Nokogiri::HTML5.fragment(thing)
241
236
  else
@@ -507,8 +507,8 @@ public
507
507
 
508
508
  # Check <tt>CLIENT_SUPPORT_FILE</tt> for any CSS warnings
509
509
  def check_client_support # :nodoc:
510
- kwargs = RUBY_VERSION >= "3.1.0" ? { aliases: true } : {}
511
- @client_support ||= YAML::load(File.open(CLIENT_SUPPORT_FILE), **kwargs)
510
+ kwargs = Psych::VERSION >= '4' ? { aliases: true } : {}
511
+ @client_support ||= Psych.load(File.open(CLIENT_SUPPORT_FILE), **kwargs)
512
512
 
513
513
  warnings = []
514
514
  properties = []
@@ -1,4 +1,4 @@
1
1
  class Premailer
2
2
  # Premailer version.
3
- VERSION = '1.18.0'.freeze
3
+ VERSION = '1.20.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.18.0
4
+ version: 1.20.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-10-07 00:00:00.000000000 Z
11
+ date: 2023-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: css_parser