derelicte 0.0.1-java → 0.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -0
- data/README.md +4 -20
- data/Rakefile +5 -0
- data/lib/derelicte.rb +14 -8
- data/lib/derelicte/inliner_job.rb +1 -1
- data/lib/derelicte/version.rb +1 -1
- data/lib/jars/htmlparser-1.4.jar +0 -0
- data/spec/benchmarks.rb +44 -9
- data/spec/files/basic.css +1 -0
- data/spec/files/ink_hero.css +73 -0
- data/spec/files/ink_hero.html +230 -0
- data/spec/files/simple_dom.html +4 -1
- data/spec/files/xhtml_dom.html +14 -0
- data/spec/lib/derelicte/inliner_spec.rb +18 -7
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41cab4dd73d1b0a17862059bd4e9feca27472466
|
4
|
+
data.tar.gz: 942726e6ad32e85600495157b9f77c563aa65d48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09f486afd46ad9581d5ad2e52374cdf1a78a97e54d5c0ff041dc6c19948b1f7371f71365083190f80108a6f39c6d2ec1ce2bcb2e8629b221b9bfe0653c94d112
|
7
|
+
data.tar.gz: 9b558ad919622a17d78e79d8167184b494ee369cd3f4cf7fee6c75eee17ca0f5360bd210584913d83ee757400a098510bbf8c42f52a544433d7ce49818e3aa22
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Derelicte
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/hqmq/derelicte.png)](https://travis-ci.org/hqmq/derelicte)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/hqmq/derelicte.png)](https://codeclimate.com/github/hqmq/derelicte)
|
5
|
+
[![Dependency Status](https://gemnasium.com/hqmq/derelicte.png)](https://gemnasium.com/hqmq/derelicte)
|
6
|
+
|
3
7
|
![Derelicte Gif](http://24.media.tumblr.com/d7c64874eeae527c2661cda9c107984c/tumblr_msas87gWdt1qaehqco1_400.gif)
|
4
8
|
|
5
9
|
A JRuby specific gem that takes an html template and css file and inlines the css rules into style attributes. This is mostly useful for sending emails.
|
@@ -33,23 +37,3 @@ css = "p { color: #ff0000; }"
|
|
33
37
|
inliner = CSS::Inliner.new
|
34
38
|
inlined_html = inliner.inline(html, css) # => "<p style=\"color: #ff0000;\">ohai</p>"
|
35
39
|
```
|
36
|
-
|
37
|
-
|
38
|
-
## Current Issues
|
39
|
-
|
40
|
-
* doctypes with full URLs (like xhtml) will make the process extremely slow since the standard java libraries attempt to fetch and parse the DTD. It is highly recommended that you simply use an HTML 5 style doctype (<code><!DOCTYPE html></code>)
|
41
|
-
* Since we use a basic XML parser it is pretty sensitive to bad markup. Things like unclosed breaks will cause it to choke. Make sure you double-check your templates.
|
42
|
-
|
43
|
-
```html
|
44
|
-
<!-- Things that will break the XML parsing -->
|
45
|
-
<br>
|
46
|
-
<img href="/icon.png">
|
47
|
-
<meta charset='utf-8'>
|
48
|
-
<hr>
|
49
|
-
|
50
|
-
<!-- These things are okay for the XML parser -->
|
51
|
-
<br/>
|
52
|
-
<img href="/icon.png" />
|
53
|
-
<meta charset='utf-8' />
|
54
|
-
<hr/>
|
55
|
-
```
|
data/Rakefile
CHANGED
data/lib/derelicte.rb
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
require "derelicte/version"
|
2
2
|
|
3
3
|
# Load jars
|
4
|
-
|
5
|
-
require 'jars/
|
6
|
-
|
4
|
+
unless defined?(::Java::OrgAntlrRuntime::Parser)
|
5
|
+
require 'jars/antlr-runtime-3.1.jar'
|
6
|
+
end
|
7
|
+
unless defined?(org.slf4j.Logger)
|
8
|
+
require 'jars/slf4j-api-1.5.2.jar'
|
9
|
+
require 'jars/slf4j-nop-1.5.2.jar'
|
10
|
+
end
|
7
11
|
require 'jars/xml-apis-1.3.04.jar'
|
8
|
-
|
12
|
+
unless defined?(::Java.cz.vutbr.web.css::CSSFactory)
|
13
|
+
require 'jars/jstyleparser-1.7.0.jar'
|
14
|
+
end
|
15
|
+
unless defined?(Java::NuValidatorHtmlparserDom::HtmlDocumentBuilder)
|
16
|
+
require 'jars/htmlparser-1.4'
|
17
|
+
end
|
9
18
|
|
10
19
|
# Load local classes
|
11
20
|
require 'derelicte/inliner'
|
@@ -22,10 +31,7 @@ module Derelicte
|
|
22
31
|
def self.doc_from_str(str)
|
23
32
|
reader = java.io.StringReader.new(str.to_java_string)
|
24
33
|
source = Java::OrgXmlSax::InputSource.new(reader)
|
25
|
-
|
26
|
-
fac.set_validating(false)
|
27
|
-
fac.set_namespace_aware(false)
|
28
|
-
builder = fac.new_document_builder
|
34
|
+
builder = Java.nu.validator.htmlparser.dom.HtmlDocumentBuilder.new
|
29
35
|
builder.parse(source)
|
30
36
|
end
|
31
37
|
|
@@ -18,7 +18,7 @@ module Derelicte
|
|
18
18
|
|
19
19
|
def apply_rules_to(element)
|
20
20
|
rules = assignments.get(element)
|
21
|
-
return nil if rules.nil?
|
21
|
+
return nil if rules.nil? || rules.length == 0
|
22
22
|
rule_str = rules.map(&:to_s).map(&:chomp).join
|
23
23
|
element.set_attribute('style', rule_str)
|
24
24
|
end
|
data/lib/derelicte/version.rb
CHANGED
Binary file
|
data/spec/benchmarks.rb
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
require 'bundler/setup'
|
2
|
-
require '
|
2
|
+
require 'derelicte'
|
3
3
|
require 'benchmark'
|
4
4
|
require 'fileutils'
|
5
5
|
|
6
6
|
files_dir = File.join(File.dirname(__FILE__), 'files')
|
7
|
-
html_file = File.join(files_dir, '
|
7
|
+
html_file = File.join(files_dir, 'ink_hero.html')
|
8
8
|
css_file = File.join(files_dir, 'ink.css')
|
9
|
+
css_file2 = File.join(files_dir, 'ink_hero.css')
|
9
10
|
html_str = File.read(html_file)
|
10
|
-
css_str = File.read(css_file)
|
11
|
+
css_str = File.read(css_file) + File.read(css_file2)
|
11
12
|
|
12
13
|
output_dir = File.join(File.dirname(__FILE__), '..', 'tmp')
|
13
|
-
output_file = File.join(output_dir, '
|
14
|
+
output_file = File.join(output_dir, 'ink_hero.inlined.html')
|
14
15
|
FileUtils.mkdir_p(output_dir)
|
15
16
|
|
16
|
-
inliner =
|
17
|
+
inliner = Derelicte::Inliner.new
|
17
18
|
|
18
19
|
# Get an initial benchmark
|
19
20
|
Benchmark.bm(40) do |bm|
|
20
|
-
bm.report('initial run') do
|
21
|
+
bm.report('initial run (1x)') do
|
21
22
|
inliner.inline(html_str, css_str)
|
22
23
|
end
|
23
24
|
end
|
@@ -28,13 +29,47 @@ File.open(output_file, 'w') do |f|
|
|
28
29
|
end
|
29
30
|
|
30
31
|
# Warmup the JIT
|
31
|
-
|
32
|
+
1000.times do
|
32
33
|
inliner.inline(html_str, css_str)
|
33
34
|
end
|
34
35
|
|
35
36
|
# Benchmark the JIT optimized time
|
36
37
|
Benchmark.bm(40) do |bm|
|
37
|
-
bm.report('after warmup') do
|
38
|
-
|
38
|
+
bm.report('after warmup (10x)') do
|
39
|
+
10.times do
|
40
|
+
inliner.inline(html_str, css_str)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
doc = ::Derelicte.doc_from_str(html_str)
|
46
|
+
analyzer = ::Derelicte.css_analyzer_from_str(css_str)
|
47
|
+
job = ::Derelicte::InlinerJob.new(doc, analyzer)
|
48
|
+
job.send(:assignments)
|
49
|
+
|
50
|
+
Benchmark.bm(40) do |bm|
|
51
|
+
bm.report('parse doc (10x)') do
|
52
|
+
10.times do
|
53
|
+
doc = Derelicte.doc_from_str(html_str)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
bm.report('parse css to analyzer (10x)') do
|
58
|
+
10.times do
|
59
|
+
analyzer = ::Derelicte.css_analyzer_from_str(css_str)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
bm.report('evaluate rules for doc (10x)') do
|
64
|
+
10.times do
|
65
|
+
job = ::Derelicte::InlinerJob.new(doc, analyzer)
|
66
|
+
job.send(:assignments)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
bm.report('apply rules to doc (10x)') do
|
71
|
+
10.times do
|
72
|
+
job.apply_rules_to_doc
|
73
|
+
end
|
39
74
|
end
|
40
75
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
p { color: #ff0000; }
|
@@ -0,0 +1,73 @@
|
|
1
|
+
table.facebook td {
|
2
|
+
background: #3b5998;
|
3
|
+
border-color: #2d4473;
|
4
|
+
}
|
5
|
+
|
6
|
+
table.facebook:hover td {
|
7
|
+
background: #2d4473 !important;
|
8
|
+
}
|
9
|
+
|
10
|
+
table.twitter td {
|
11
|
+
background: #00acee;
|
12
|
+
border-color: #0087bb;
|
13
|
+
}
|
14
|
+
|
15
|
+
table.twitter:hover td {
|
16
|
+
background: #0087bb !important;
|
17
|
+
}
|
18
|
+
|
19
|
+
table.google-plus td {
|
20
|
+
background-color: #DB4A39;
|
21
|
+
border-color: #CC0000;
|
22
|
+
}
|
23
|
+
|
24
|
+
table.google-plus:hover td {
|
25
|
+
background: #CC0000 !important;
|
26
|
+
}
|
27
|
+
|
28
|
+
.template-label {
|
29
|
+
color: #ffffff;
|
30
|
+
font-weight: bold;
|
31
|
+
font-size: 11px;
|
32
|
+
}
|
33
|
+
|
34
|
+
.callout .panel {
|
35
|
+
background: #ECF8FF;
|
36
|
+
border-color: #b9e5ff;
|
37
|
+
}
|
38
|
+
|
39
|
+
.header {
|
40
|
+
background: #999999;
|
41
|
+
}
|
42
|
+
|
43
|
+
.footer .wrapper {
|
44
|
+
background: #ebebeb;
|
45
|
+
}
|
46
|
+
|
47
|
+
.footer h5 {
|
48
|
+
padding-bottom: 10px;
|
49
|
+
}
|
50
|
+
|
51
|
+
table.columns .text-pad {
|
52
|
+
padding-left: 10px;
|
53
|
+
padding-right: 10px;
|
54
|
+
}
|
55
|
+
|
56
|
+
table.columns .left-text-pad {
|
57
|
+
padding-left: 10px;
|
58
|
+
}
|
59
|
+
|
60
|
+
table.columns .right-text-pad {
|
61
|
+
padding-right: 10px;
|
62
|
+
}
|
63
|
+
|
64
|
+
@media only screen and (max-width: 600px) {
|
65
|
+
|
66
|
+
table[class="body"] .right-text-pad {
|
67
|
+
padding-left: 10px !important;
|
68
|
+
}
|
69
|
+
|
70
|
+
table[class="body"] .left-text-pad {
|
71
|
+
padding-right: 10px !important;
|
72
|
+
}
|
73
|
+
}
|
@@ -0,0 +1,230 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<meta name="viewport" content="width=device-width"/>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<table class="body">
|
9
|
+
<tr>
|
10
|
+
<td class="center" align="center" valign="top">
|
11
|
+
<center>
|
12
|
+
|
13
|
+
|
14
|
+
<table class="row header">
|
15
|
+
<tr>
|
16
|
+
<td class="center" align="center">
|
17
|
+
<center>
|
18
|
+
|
19
|
+
<table class="container">
|
20
|
+
<tr>
|
21
|
+
<td class="wrapper last">
|
22
|
+
|
23
|
+
<table class="twelve columns">
|
24
|
+
<tr>
|
25
|
+
|
26
|
+
<td class="six sub-columns">
|
27
|
+
<img src="http://placehold.it/200x50"/>
|
28
|
+
</td>
|
29
|
+
<td class="six sub-columns last" align="right" style="text-align:right; vertical-align:middle;">
|
30
|
+
<span class="template-label">HERO</span>
|
31
|
+
</td>
|
32
|
+
<td class="expander"></td>
|
33
|
+
|
34
|
+
</tr>
|
35
|
+
</table>
|
36
|
+
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
</table>
|
40
|
+
|
41
|
+
</center>
|
42
|
+
</td>
|
43
|
+
</tr>
|
44
|
+
</table>
|
45
|
+
<br/>
|
46
|
+
|
47
|
+
<table class="container">
|
48
|
+
<tr>
|
49
|
+
<td>
|
50
|
+
|
51
|
+
<!-- content start -->
|
52
|
+
<table class="row">
|
53
|
+
<tr>
|
54
|
+
<td class="wrapper last">
|
55
|
+
|
56
|
+
<table class="twelve columns">
|
57
|
+
<tr>
|
58
|
+
<td>
|
59
|
+
|
60
|
+
<h1>Hi, Elijah Baily</h1>
|
61
|
+
<p class="lead">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et.</p>
|
62
|
+
<img width="580" height="300" src="http://placehold.it/580x300"/>
|
63
|
+
|
64
|
+
</td>
|
65
|
+
<td class="expander"></td>
|
66
|
+
</tr>
|
67
|
+
</table>
|
68
|
+
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
|
73
|
+
<table class="row callout">
|
74
|
+
<tr>
|
75
|
+
<td class="wrapper last">
|
76
|
+
|
77
|
+
<table class="twelve columns">
|
78
|
+
<tr>
|
79
|
+
<td class="panel">
|
80
|
+
|
81
|
+
<p>Phasellus dictum sapien a neque luctus cursus. Pellentesque sem dolor, fringilla et pharetra vitae. <a href="#">Click it! »</a></p>
|
82
|
+
|
83
|
+
</td>
|
84
|
+
<td class="expander"></td>
|
85
|
+
</tr>
|
86
|
+
</table>
|
87
|
+
|
88
|
+
</td>
|
89
|
+
</tr>
|
90
|
+
</table>
|
91
|
+
|
92
|
+
<table class="row">
|
93
|
+
<tr>
|
94
|
+
<td class="wrapper last">
|
95
|
+
|
96
|
+
<table class="twelve columns">
|
97
|
+
<tr>
|
98
|
+
<td>
|
99
|
+
|
100
|
+
<h3>Title Ipsum <small>This is a note.</small></h3>
|
101
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
102
|
+
|
103
|
+
</td>
|
104
|
+
<td class="expander"></td>
|
105
|
+
</tr>
|
106
|
+
</table>
|
107
|
+
|
108
|
+
</td>
|
109
|
+
</tr>
|
110
|
+
</table>
|
111
|
+
|
112
|
+
|
113
|
+
<table class="row">
|
114
|
+
<tr>
|
115
|
+
<td class="wrapper last">
|
116
|
+
|
117
|
+
<table class="three columns">
|
118
|
+
<tr>
|
119
|
+
<td>
|
120
|
+
|
121
|
+
<table class="button">
|
122
|
+
<tr>
|
123
|
+
<td>
|
124
|
+
<a href="#">Click Me!</a>
|
125
|
+
</td>
|
126
|
+
</tr>
|
127
|
+
</table>
|
128
|
+
|
129
|
+
</td>
|
130
|
+
<td class="expander"></td>
|
131
|
+
</tr>
|
132
|
+
</table>
|
133
|
+
|
134
|
+
</td>
|
135
|
+
</tr>
|
136
|
+
</table>
|
137
|
+
|
138
|
+
|
139
|
+
<table class="row footer">
|
140
|
+
<tr>
|
141
|
+
<td class="wrapper">
|
142
|
+
|
143
|
+
<table class="six columns">
|
144
|
+
<tr>
|
145
|
+
<td class="left-text-pad">
|
146
|
+
|
147
|
+
<h5>Connect With Us:</h5>
|
148
|
+
|
149
|
+
<table class="tiny-button facebook">
|
150
|
+
<tr>
|
151
|
+
<td>
|
152
|
+
<a href="#">Facebook</a>
|
153
|
+
</td>
|
154
|
+
</tr>
|
155
|
+
</table>
|
156
|
+
|
157
|
+
<br/>
|
158
|
+
|
159
|
+
<table class="tiny-button twitter">
|
160
|
+
<tr>
|
161
|
+
<td>
|
162
|
+
<a href="#">Twitter</a>
|
163
|
+
</td>
|
164
|
+
</tr>
|
165
|
+
</table>
|
166
|
+
|
167
|
+
<br/>
|
168
|
+
|
169
|
+
<table class="tiny-button google-plus">
|
170
|
+
<tr>
|
171
|
+
<td>
|
172
|
+
<a href="#">Google +</a>
|
173
|
+
</td>
|
174
|
+
</tr>
|
175
|
+
</table>
|
176
|
+
|
177
|
+
</td>
|
178
|
+
<td class="expander"></td>
|
179
|
+
</tr>
|
180
|
+
</table>
|
181
|
+
|
182
|
+
</td>
|
183
|
+
<td class="wrapper last">
|
184
|
+
|
185
|
+
<table class="six columns">
|
186
|
+
<tr>
|
187
|
+
<td class="last right-text-pad">
|
188
|
+
<h5>Contact Info:</h5>
|
189
|
+
<p>Phone: 408.341.0600</p>
|
190
|
+
<p>Email: <a href="mailto:hseldon@trantor.com">hseldon@trantor.com</a></p>
|
191
|
+
</td>
|
192
|
+
<td class="expander"></td>
|
193
|
+
</tr>
|
194
|
+
</table>
|
195
|
+
|
196
|
+
</td>
|
197
|
+
</tr>
|
198
|
+
</table>
|
199
|
+
|
200
|
+
|
201
|
+
<table class="row">
|
202
|
+
<tr>
|
203
|
+
<td class="wrapper last">
|
204
|
+
|
205
|
+
<table class="twelve columns">
|
206
|
+
<tr>
|
207
|
+
<td align="center">
|
208
|
+
<center>
|
209
|
+
<p style="text-align:center;"><a href="#">Terms</a> | <a href="#">Privacy</a> | <a href="#">Unsubscribe</a></p>
|
210
|
+
</center>
|
211
|
+
</td>
|
212
|
+
<td class="expander"></td>
|
213
|
+
</tr>
|
214
|
+
</table>
|
215
|
+
|
216
|
+
</td>
|
217
|
+
</tr>
|
218
|
+
</table>
|
219
|
+
|
220
|
+
<!-- container end below -->
|
221
|
+
</td>
|
222
|
+
</tr>
|
223
|
+
</table>
|
224
|
+
|
225
|
+
</center>
|
226
|
+
</td>
|
227
|
+
</tr>
|
228
|
+
</table>
|
229
|
+
</body>
|
230
|
+
</html>
|
data/spec/files/simple_dom.html
CHANGED
@@ -2,10 +2,13 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
|
5
|
-
|
5
|
+
<!-- tolerate meta tags without a shortcut close -->
|
6
|
+
<meta content="width=device-width" name="viewport" >
|
6
7
|
<title>My Stable CU</title>
|
7
8
|
</head>
|
8
9
|
<body>
|
9
10
|
<p>ohai</p>
|
11
|
+
<!-- comments should be fine -->
|
12
|
+
<p>• html chars should be okay</p>
|
10
13
|
</body>
|
11
14
|
</html>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
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
|
+
<!-- comments should be fine -->
|
12
|
+
<p>• html chars should be okay</p>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -1,18 +1,29 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Derelicte::Inliner do
|
4
|
-
let(:
|
5
|
-
let(:
|
4
|
+
let(:html) { file_contents('simple_dom.html') }
|
5
|
+
let(:css) { file_contents('basic.css') }
|
6
6
|
|
7
7
|
subject { described_class.new }
|
8
8
|
it "should apply css rules to html elements" do
|
9
9
|
inlined_html = subject.inline(html, css)
|
10
|
-
expect(inlined_html).to include('<
|
10
|
+
expect(inlined_html).to include('<p style="color: #ff0000;">ohai</p>')
|
11
|
+
expect(inlined_html).to start_with('<!DOCTYPE html>')
|
11
12
|
end
|
12
13
|
|
13
|
-
it "should
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
it "should return valid html" do
|
15
|
+
inlined_html = subject.inline(html, css)
|
16
|
+
expect {
|
17
|
+
Derelicte.doc_from_str(inlined_html)
|
18
|
+
}.to_not raise_error
|
19
|
+
end
|
20
|
+
|
21
|
+
context "xhtml doctype" do
|
22
|
+
let(:html) { file_contents('xhtml_dom.html') }
|
23
|
+
|
24
|
+
it "should change the doctype to html 5 standard" do
|
25
|
+
inlined_html = subject.inline(html, css)
|
26
|
+
expect(inlined_html).to start_with("<!DOCTYPE html>")
|
27
|
+
end
|
17
28
|
end
|
18
29
|
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.2
|
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-01-
|
11
|
+
date: 2014-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- .gitignore
|
91
91
|
- .ruby-gemset
|
92
92
|
- .ruby-version
|
93
|
+
- .travis.yml
|
93
94
|
- Gemfile
|
94
95
|
- LICENSE.txt
|
95
96
|
- README.md
|
@@ -100,14 +101,19 @@ files:
|
|
100
101
|
- lib/derelicte/inliner_job.rb
|
101
102
|
- lib/derelicte/version.rb
|
102
103
|
- lib/jars/antlr-runtime-3.1.jar
|
104
|
+
- lib/jars/htmlparser-1.4.jar
|
103
105
|
- lib/jars/jstyleparser-1.7.0.jar
|
104
106
|
- lib/jars/slf4j-api-1.5.2.jar
|
105
107
|
- lib/jars/slf4j-nop-1.5.2.jar
|
106
108
|
- lib/jars/xml-apis-1.3.04.jar
|
107
109
|
- spec/benchmarks.rb
|
110
|
+
- spec/files/basic.css
|
108
111
|
- spec/files/ink.css
|
109
112
|
- spec/files/ink_boilerplate.html
|
113
|
+
- spec/files/ink_hero.css
|
114
|
+
- spec/files/ink_hero.html
|
110
115
|
- spec/files/simple_dom.html
|
116
|
+
- spec/files/xhtml_dom.html
|
111
117
|
- spec/lib/derelicte/inliner_spec.rb
|
112
118
|
- spec/spec_helper.rb
|
113
119
|
homepage: https://github.com/hqmq/derelicte
|
@@ -136,8 +142,12 @@ specification_version: 4
|
|
136
142
|
summary: JRuby specific css inliner aiming for maximum performance
|
137
143
|
test_files:
|
138
144
|
- spec/benchmarks.rb
|
145
|
+
- spec/files/basic.css
|
139
146
|
- spec/files/ink.css
|
140
147
|
- spec/files/ink_boilerplate.html
|
148
|
+
- spec/files/ink_hero.css
|
149
|
+
- spec/files/ink_hero.html
|
141
150
|
- spec/files/simple_dom.html
|
151
|
+
- spec/files/xhtml_dom.html
|
142
152
|
- spec/lib/derelicte/inliner_spec.rb
|
143
153
|
- spec/spec_helper.rb
|