html_inline_css 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 67bc2dfe2bbdfb63d8dfe20699d9191ed5800763
4
- data.tar.gz: f324638b4722c7fa6da597b3c94096bc328c791c
3
+ metadata.gz: ab36466db22d447c5ac4948b1e5d07fbdf9b2e95
4
+ data.tar.gz: be5f20e88868e3f5e3c8f89e0075045f47cecdd1
5
5
  SHA512:
6
- metadata.gz: 45109e3180550e85db4a4a9aaf245683426143308c58b27816bf7195f6fe4939302d20912687939c38991b5d33dec1a6970c350cdbe06d63e14d6b8a6e5847d9
7
- data.tar.gz: 17b50d0684315e7601211af7d57ef3244df56d688d1f7564bcd694695645d773838225cda0ba6bc7d5c0c39d9f1ec2291814772ef4c7c95419235450dc279948
6
+ metadata.gz: e75cd54aef1980b60693573d6178d3d5d18f5f0d30f13de2f225ed685fbe4a2be58c649df09399c0e5526e4b02c2ef88c9732dec9fe98c98cd44205a7af206a4
7
+ data.tar.gz: 985808f61861e992316888448de70a7a6c09f81e42a4b0a8d8deb5e4f9e812ce130656ff524a9fb5c7f0be84330b30d164a7e78170cf93f6ddc586dd6062e3df
@@ -4,19 +4,6 @@ require "nokogiri"
4
4
  module InlineCssString
5
5
  class CSS
6
6
 
7
- def self.inline_css(html)
8
- @html_tags = ["div","span","b","a","i","abbr","acronym","address","applet","area","article","aside","bdi","big","blockquote","caption","center","cite","code","col","colgroup","datalist","dd","del","details","dfn","dialog","dir","dl","dt","em","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","hr","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meter","nav","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","strike","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","wbr"]
9
- @classes = Array.new
10
- @ids = Array.new
11
- @html_without_skeleton = html.gsub(/<style>(.*?)\n\t\t<\/style>|<style>(.*?)<\/style>|<html>|<\/html>|<head>|<\/head>|<body>|<\/body>|<script>|<\/script>/,"")
12
- @doc = Nokogiri::HTML::DocumentFragment.parse(html)
13
- @doc_to = Nokogiri::HTML::DocumentFragment.parse(@html_without_skeleton)
14
- get_all_class_and_ids
15
- add_style_tag_to_html(@doc_to)
16
- inline_css_from_style_tag(@doc)
17
- return @doc_to.to_html
18
- end
19
-
20
7
  def get_all_class_and_ids
21
8
  @html_tags.each do |tag|
22
9
  @doc_to.css("#{tag}").each do |y|
@@ -395,5 +382,18 @@ module InlineCssString
395
382
  end
396
383
  end
397
384
 
385
+ def self.inline_css(html)
386
+ @html_tags = ["div","span","b","a","i","abbr","acronym","address","applet","area","article","aside","bdi","big","blockquote","caption","center","cite","code","col","colgroup","datalist","dd","del","details","dfn","dialog","dir","dl","dt","em","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","hr","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meter","nav","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","strike","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","wbr"]
387
+ @classes = Array.new
388
+ @ids = Array.new
389
+ @html_without_skeleton = html.gsub(/<style>(.*?)\n\t\t<\/style>|<style>(.*?)<\/style>|<html>|<\/html>|<head>|<\/head>|<body>|<\/body>|<script>|<\/script>/,"")
390
+ @doc = Nokogiri::HTML::DocumentFragment.parse(html)
391
+ @doc_to = Nokogiri::HTML::DocumentFragment.parse(@html_without_skeleton)
392
+ get_all_class_and_ids
393
+ add_style_tag_to_html(@doc_to)
394
+ inline_css_from_style_tag(@doc)
395
+ return @doc_to.to_html
396
+ end
397
+
398
398
  end
399
399
  end
@@ -1,3 +1,3 @@
1
1
  module HtmlInlineCss
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_inline_css
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolai Berg Andersen