derelicte 0.0.6-java → 0.0.7-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/derelicte/inliner_job.rb +2 -0
- data/lib/derelicte/version.rb +1 -1
- data/spec/files/inline_style_dom.html +15 -0
- data/spec/lib/derelicte/inliner_spec.rb +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa1dd5c05414ba885696563f358eb68842f2b4a5
|
4
|
+
data.tar.gz: 3be1c863f27285bd59bbf87a8f984d997821351f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c254547a333140932fcf521a8ebc486b4ddd7cd0fb0821c00a2276de763503704b89284b74970ec9490ed8b03c5a41bd7c8009dbee23120b482514c4c30e3f63
|
7
|
+
data.tar.gz: fca6348e9a5b6e237770d279f0e6e43d44e4806e4463cf6556b4915b207991b847385bac545f8a5b09e0dfb26eba9f92d17bd7b98bc2a6eec113dca4f3dae792
|
@@ -19,10 +19,12 @@ module Derelicte
|
|
19
19
|
rules = assignments.get(element)
|
20
20
|
return nil if rules.nil? || rules.length == 0
|
21
21
|
rule_str = unique_rules(rules).map(&:to_s).map(&:chomp).join
|
22
|
+
rule_str << element.get_attribute('style') if element.get_attribute('style')
|
22
23
|
element.set_attribute('style', rule_str)
|
23
24
|
end
|
24
25
|
|
25
26
|
def assignments
|
27
|
+
# assing_declarations_to_dom is a method from the java library
|
26
28
|
@assignments ||= analyzer.assing_declarations_to_dom(doc, "screen", false)
|
27
29
|
end
|
28
30
|
|
data/lib/derelicte/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
|
5
|
+
<!-- tolerate meta tags without a shortcut close -->
|
6
|
+
<meta content="width=device-width" name="viewport" >
|
7
|
+
<title>My Stable CU</title>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<p>ohai</p>
|
11
|
+
<p style="font-size: 18pt;">ohai</p>
|
12
|
+
<!-- comments should be fine -->
|
13
|
+
<p>• html chars should be okay</p>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -26,4 +26,14 @@ describe Derelicte::Inliner do
|
|
26
26
|
expect(inlined_html).to start_with("<!DOCTYPE html>")
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
30
|
+
context "existing inline styles" do
|
31
|
+
let(:html) { file_contents('inline_style_dom.html') }
|
32
|
+
|
33
|
+
it "should append to existing inline styles" do
|
34
|
+
inlined_html = subject.inline(html, css)
|
35
|
+
expect(inlined_html).to include('<p style="color: #ff0000;">ohai</p>')
|
36
|
+
expect(inlined_html).to include('<p style="color: #ff0000;font-size: 18pt;">ohai</p>')
|
37
|
+
end
|
38
|
+
end
|
29
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: derelicte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Michael Ries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- spec/files/ink_boilerplate.html
|
112
112
|
- spec/files/ink_hero.css
|
113
113
|
- spec/files/ink_hero.html
|
114
|
+
- spec/files/inline_style_dom.html
|
114
115
|
- spec/files/simple_dom.html
|
115
116
|
- spec/files/xhtml_dom.html
|
116
117
|
- spec/lib/derelicte/inliner_job_spec.rb
|
@@ -148,6 +149,7 @@ test_files:
|
|
148
149
|
- spec/files/ink_boilerplate.html
|
149
150
|
- spec/files/ink_hero.css
|
150
151
|
- spec/files/ink_hero.html
|
152
|
+
- spec/files/inline_style_dom.html
|
151
153
|
- spec/files/simple_dom.html
|
152
154
|
- spec/files/xhtml_dom.html
|
153
155
|
- spec/lib/derelicte/inliner_job_spec.rb
|