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 +4 -4
- data/lib/html_inline_css.rb +13 -13
- data/lib/html_inline_css/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab36466db22d447c5ac4948b1e5d07fbdf9b2e95
|
4
|
+
data.tar.gz: be5f20e88868e3f5e3c8f89e0075045f47cecdd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e75cd54aef1980b60693573d6178d3d5d18f5f0d30f13de2f225ed685fbe4a2be58c649df09399c0e5526e4b02c2ef88c9732dec9fe98c98cd44205a7af206a4
|
7
|
+
data.tar.gz: 985808f61861e992316888448de70a7a6c09f81e42a4b0a8d8deb5e4f9e812ce130656ff524a9fb5c7f0be84330b30d164a7e78170cf93f6ddc586dd6062e3df
|
data/lib/html_inline_css.rb
CHANGED
@@ -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
|