html-to-css 0.1.7 → 0.1.8
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -2
- data/lib/html-to-css.rb +20 -10
- metadata +33 -28
- metadata.gz.sig +1 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b389264959efdf5f215abe2c3afbceb0ac5cde2
|
4
|
+
data.tar.gz: 55f7696d99e42ab552b1f6d13f480abd98c633be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61377535f03dedf9ee802174afe074377472287fbd34ffa737f03305b46c1f8f860e969b067fea7d45130f8465bf6a20907e3d239a97cec7b5f038d82131c3bb
|
7
|
+
data.tar.gz: 6261b04f4b6e68e18ec8b2b2854fb660a36ffc6f1830ba1eb72e5957fcf6465872d70a2c5bae01a07d2a0c669b4c0f5ebc5ede96b469cfde21a1ca6927e77c1c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
�z}ꣳ��0~�F��DWce[4
|
1
|
+
�/�_�P��Hy�Vk�bR�x{��U/ɿJ�ËMj��V���US$��R��h�^ޟ�?�kH��<060�q����Kb� &�K�,'$?�e����C��Di�$��/2��0W���Q3۠[�'�.`�^v����"z8��r�:�W{%=�1���>⛐V�3k��#�A�ah���8��R��i����x����������C�0[�@� N�*swݑ�1u�f3�7y�_�����x���C��&
|
data/lib/html-to-css.rb
CHANGED
@@ -4,12 +4,21 @@
|
|
4
4
|
|
5
5
|
require 'rexle'
|
6
6
|
|
7
|
+
|
8
|
+
module CSSHelper
|
9
|
+
def self.all_background_transparent(s)
|
10
|
+
s.gsub(/rgba[^\)]+\)/, 'transparent')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
7
14
|
module StringHelper
|
8
15
|
|
9
16
|
refine String do
|
10
17
|
|
11
18
|
def to_h()
|
12
|
-
Hash[
|
19
|
+
Hash[
|
20
|
+
self.gsub(/\n/,'').split(/;\s*/).map{|x| x.split(/:/,2).map(&:strip)}
|
21
|
+
]
|
13
22
|
end
|
14
23
|
|
15
24
|
end
|
@@ -21,21 +30,21 @@ class HtmlToCss
|
|
21
30
|
|
22
31
|
attr_accessor :elements
|
23
32
|
|
24
|
-
def initialize(
|
33
|
+
def initialize(s=nil, rand_color: true, file: nil)
|
25
34
|
|
26
|
-
|
27
|
-
filename = opt[:filename]
|
28
|
-
@rand_color = opt[:rand_color]
|
35
|
+
@rand_color = rand_color
|
29
36
|
|
30
|
-
if
|
37
|
+
if s then
|
38
|
+
@doc = Rexle.new s
|
39
|
+
elsif file
|
31
40
|
|
32
|
-
@doc = Rexle.new File.read(
|
41
|
+
@doc = Rexle.new File.read(file)
|
33
42
|
|
34
43
|
else
|
35
44
|
|
36
45
|
a = Dir.glob("*.html")
|
37
46
|
@doc = Rexle.new File.read(a.pop)
|
38
|
-
a.each {|
|
47
|
+
a.each {|f| merge(@doc, Rexle.new(File.read(f)).root ) }
|
39
48
|
end
|
40
49
|
|
41
50
|
@selectors = []
|
@@ -93,7 +102,7 @@ class HtmlToCss
|
|
93
102
|
scan_to_css(type, doc.root)
|
94
103
|
@layout_selectors = @selectors.clone
|
95
104
|
@css.join "\n"
|
96
|
-
end
|
105
|
+
end
|
97
106
|
|
98
107
|
def merge(mdoc, e, axpath=[], prev_tally=[])
|
99
108
|
|
@@ -145,7 +154,8 @@ class HtmlToCss
|
|
145
154
|
|
146
155
|
if @elements.has_key?(e.name.to_sym) then
|
147
156
|
#c = @rand_color ? "#%06x" % (rand * 0xffffff) : '#a5f'
|
148
|
-
c = @rand_color ? "rgba(%s,%s,%s, 0.3)" % 3.times.map{rand(255)}
|
157
|
+
c = @rand_color ? "rgba(%s,%s,%s, 0.3)" % 3.times.map{rand(255)} \
|
158
|
+
: '#a5f'
|
149
159
|
|
150
160
|
attributes = @elements[e.name.to_sym].strip.sub(':color', c).to_h
|
151
161
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html-to-css
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,45 +10,50 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
6yGZgJtO0psElQ==
|
13
|
+
MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwMjA5MTU1MjE4WhcN
|
15
|
+
MTkwMjA5MTU1MjE4WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDX/Hig
|
17
|
+
D2Ka2OGESEkeBcuVYdGUPyhsluMmxMM9oBDaqzdTHrI/nWoPiU1OkwNsbx017kiF
|
18
|
+
UHdSph0/4ltECX55lw9GdRT5jquPm74RAt8F0EHyliHhNK6BE/yCRJQomonaO6WL
|
19
|
+
ibz1fITQPoFngsYsPtxNin6hdsZRnHuwa55ziqekE4Gw5/mlDH+uB/gGaPlWKyv3
|
20
|
+
sIATD+LXLgcVNU5/R6QEVzRH+i+ruapZZKY6NyYGO2Mfi4CDvG3oAo/x3ZEwQ8sk
|
21
|
+
fmg6gEKNPPWm0DnamDsAfMHacghtWTnps75SwfmZliBDrQpX8PSgCvzrj8uh2fM6
|
22
|
+
aJ9mYp9HTGIiVRTzAgMBAAGjgYowgYcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
23
|
+
HQYDVR0OBBYEFNxupFqmZd1FlWGA7A4IROGunMD0MCYGA1UdEQQfMB2BG2dlbW1h
|
24
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTAmBgNVHRIEHzAdgRtnZW1tYXN0ZXJAamFt
|
25
|
+
ZXNyb2JlcnRzb24uZXUwDQYJKoZIhvcNAQEFBQADggEBAC8auSr7e9GuAeSajWqS
|
26
|
+
8HcWZDpkCbNXOyPRQOnIbPwEsXMjP9Won1FAvkLuyXH6dMd+FN4VI7JZ/Wgg7R+x
|
27
|
+
n0vjppzjDTr98rlVcl64xlUqzY+RK0ZKG5lbdBFM9l259OU0ZAoAvgjylgRDjkaz
|
28
|
+
6rlyBskftC5S9HG2oMgRIop/VWWJ7UQmyw+bvjfXl0jLtL2d7sleUkRR3l+dHHHI
|
29
|
+
xUCLmBESe6RydOFlD5m8tWvGuup6olperoukPUtWSgNbISTQXfx2ecisr0D2G0Lo
|
30
|
+
J83n85iklZsL8LmNvGplh49hFIjirhenQW+8kV9gBiBcCS6c0Ine8R0Tj4bRvssn
|
31
|
+
wGo=
|
33
32
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
33
|
+
date: 2018-02-09 00:00:00.000000000 Z
|
35
34
|
dependencies:
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
36
|
name: rexle
|
38
37
|
requirement: !ruby/object:Gem::Requirement
|
39
38
|
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.4'
|
40
42
|
- - ">="
|
41
43
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
44
|
+
version: 1.4.12
|
43
45
|
type: :runtime
|
44
46
|
prerelease: false
|
45
47
|
version_requirements: !ruby/object:Gem::Requirement
|
46
48
|
requirements:
|
49
|
+
- - "~>"
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '1.4'
|
47
52
|
- - ">="
|
48
53
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
54
|
+
version: 1.4.12
|
50
55
|
description:
|
51
|
-
email: james@
|
56
|
+
email: james@jamesrobertson.eu
|
52
57
|
executables: []
|
53
58
|
extensions: []
|
54
59
|
extra_rdoc_files: []
|
@@ -66,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
71
|
requirements:
|
67
72
|
- - ">="
|
68
73
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
74
|
+
version: 2.1.2
|
70
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
76
|
requirements:
|
72
77
|
- - ">="
|
@@ -74,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
79
|
version: '0'
|
75
80
|
requirements: []
|
76
81
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.6.13
|
78
83
|
signing_key:
|
79
84
|
specification_version: 4
|
80
|
-
summary:
|
85
|
+
summary: Generates CSS from HTML passed into it.
|
81
86
|
test_files: []
|
metadata.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
4���!���x�,�`���{� �Ƣ6��bC��P�ԇ���#bea(s$"�*łN�ׄ�{j�{7�08�U��|,x�f@-M�"4�%�n�S_nz{
|
1
|
+
a��:uk4^Y��;6��l��!L�9�Rb�0���E4�E���x�� d��;�O�h,���1ؾ�K}��Q�����m�v@��Z���Lww��M��Hx�
|