domle 0.1.12 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 480b3d1e557994971ceb2d5d7f5770b0566879d4
4
- data.tar.gz: 580264d320d643bd8c9ebc5948fbd970234c0621
3
+ metadata.gz: 582f612a1a5e85324907ee10045db2855689a06b
4
+ data.tar.gz: ec004ade570e71c3d3c6e4253ae66be9fdd335e7
5
5
  SHA512:
6
- metadata.gz: 275e085cf239e843ab6c14a5811362f8c1a5d04d7344ff9111e30ead00e9b65b38e9fdca056fdc31cc2d324b1119acb657bb1444659dad6c0dda4092d85b8a4a
7
- data.tar.gz: 6b34e5ad2d58e006f0b029f4fd79bb684bd4f85e96ac628cb47856d78aa893f2f13ffd94eaa64c020dc4ef21517f2e809396b0be489ed46c0476643a60bcd577
6
+ metadata.gz: 67fe2b68e0e106cc35de7641c3f03fb0baad360561864b24ca84d5d78f36bcae3e29059c56e85837843617cc7d17b3fec2ca21583bf90d544263db94c2b45c24
7
+ data.tar.gz: 2c87e9fd02821c299b84eada7b96729ebed7fdb2f6aa4cbb244e21a84973b464cbf574c4e506453dfb66d5802cf229051631f454282f8c4a25db7be1400ba62a
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -3,6 +3,7 @@
3
3
  # file: domle.rb
4
4
 
5
5
  require 'rexle'
6
+ require 'csslite'
6
7
  require 'rxfhelper'
7
8
 
8
9
 
@@ -163,39 +164,8 @@ class Domle < Rexle
163
164
 
164
165
  def add_css(s, override: true)
165
166
 
166
- # parse the CSS
167
-
168
- a = s.split(/}/)[0..-2].map do |entry|
169
-
170
- raw_selector,raw_styles = entry.split(/{/,2)
171
-
172
- h = raw_styles.strip.split(/;/).inject({}) do |r, x|
173
- k, v = x.split(/:/,2).map(&:strip)
174
- r.merge(k.to_sym => v)
175
- end
176
-
177
- [raw_selector.split(/,\s*/).map(&:strip), h]
178
- end
179
-
180
- # add each CSS style attribute to the element
181
- # e.g. a = [[['line'],{stroke: 'green'}]]
182
-
183
- a.each do |x|
184
-
185
- selectors, style = x
186
-
187
- selectors.each do |selector|
188
-
189
- style.each do |k,v|
190
-
191
- self.root.css(selector).each do |element|
192
-
193
- element.style[k] = v unless override == false and element.style.has_key? k
194
- end
195
- end
196
-
197
- end
198
- end
167
+ css = CSSLite.new s
168
+ css.propagate self.root
199
169
 
200
170
  end
201
171
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: domle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -53,6 +53,26 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: 1.4.7
56
+ - !ruby/object:Gem::Dependency
57
+ name: csslite
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.1'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.1.1
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.1'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.1.1
56
76
  - !ruby/object:Gem::Dependency
57
77
  name: rxfhelper
58
78
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file