mjml-rb 0.2.22 → 0.2.23

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: fb97af0d72ddb5898c28c33ccc0efafc27532f3709062f563f8d3d39fdcc642b
4
- data.tar.gz: 2bb9d55e089309e74ab77766360b3c2a094c633a73ba8fb1fa4599780813dab4
3
+ metadata.gz: f62367f40ca4f73440f35e4878e7adcfcb8002cb1011639bbe1cd55f922b7580
4
+ data.tar.gz: 952c39acdd8b9cf3e1f84da47b4b3dc11c4f35c4cf521cfaf30ad4c890197dc5
5
5
  SHA512:
6
- metadata.gz: a0fbd53af9fc541a29f0d70e123efb0d390f9023a1388f8d1f6ef23ff1ad3aa6a16a0a410975744f03d934538cb99766620ebca44ba561272ce845057dc86277
7
- data.tar.gz: 40f1fdcf06405a730a37b7d095fa6d92270e09cfd21c8fce71a2bcd8c79da52ef1f72175bfc9766395d011bec3582731b4a66135bd5f0ac8978d6c117c96e82f
6
+ metadata.gz: bd7df7e7cb49e766d89895bf5cd38351e5ce00a5b33c28ceabbf9de99a6bc88b5f2c66eec31cec72b36506c7a0a871b170d77bea0441ba964ec17990f4411d3f
7
+ data.tar.gz: 11a977350b4941d6dc852e5b4a7caa0d0a7f3b5e42a4e53d0f44bbb0ccee1ce55425d4bf66bed4024c9896ec9a44d64d884f986c56f8080b0dfb8684b625de1b
@@ -279,7 +279,7 @@ module MjmlRb
279
279
  css_blocks = unique_strings(context[:inline_styles]).reject { |css| css.nil? || css.strip.empty? }
280
280
  return html if css_blocks.empty?
281
281
 
282
- document = Nokogiri::HTML(html)
282
+ document = parse_html_document(html)
283
283
  parse_inline_css_rules(css_blocks.join("\n")).each do |selector, declarations|
284
284
  next if selector.empty? || declarations.empty?
285
285
 
@@ -291,6 +291,14 @@ module MjmlRb
291
291
  document.to_html
292
292
  end
293
293
 
294
+ def parse_html_document(html)
295
+ if defined?(Nokogiri::HTML5)
296
+ Nokogiri::HTML5(html)
297
+ else
298
+ Nokogiri::HTML(html)
299
+ end
300
+ end
301
+
294
302
  def select_nodes(document, selector)
295
303
  document.css(selector)
296
304
  rescue Nokogiri::CSS::SyntaxError, Nokogiri::XML::XPath::SyntaxError
@@ -1,3 +1,3 @@
1
1
  module MjmlRb
2
- VERSION = "0.2.22".freeze
2
+ VERSION = "0.2.23".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mjml-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.22
4
+ version: 0.2.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Andriichuk