derelicte 0.0.2-java → 0.0.3-java
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/README.md +9 -2
- data/lib/derelicte.rb +4 -0
- data/lib/derelicte/version.rb +1 -1
- data/spec/lib/derelicte_spec.rb +19 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70fa4807988c11434a77e33b813f7878a10e75ac
|
4
|
+
data.tar.gz: ffc6a190da14f82bc9caaaa3b5a18461b7c7402d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c9710f1daab033996894e4e2d3ce617c424657bb410d140ae3258bf4b281141a405641c5cbbd6ce6c4af2911dc13a123814a7861b055a259b9f0054b856d7c4
|
7
|
+
data.tar.gz: 097980411cf8095f4f365118b02acda9f35704539582ea1d4974632e01a0d4713afdf2cb8d0854aaff7e0fad903b987e4c134ae71607b422b84c234e1a7887e9
|
data/README.md
CHANGED
@@ -34,6 +34,13 @@ Simplest possible usage:
|
|
34
34
|
html = "<p>ohai</p>"
|
35
35
|
css = "p { color: #ff0000; }"
|
36
36
|
|
37
|
-
|
38
|
-
inlined_html = inliner.inline(html, css) # => "<p style=\"color: #ff0000;\">ohai</p>"
|
37
|
+
inlined_html = ::Derelicte.inline(html, css) # => "<p style=\"color: #ff0000;\">ohai</p>"
|
39
38
|
```
|
39
|
+
|
40
|
+
## Roadmap
|
41
|
+
|
42
|
+
Some basic profiling shows that the current process spends about 1/3 of its time parsing the css rules and 1/3 of its time applying the rules to the DOM.
|
43
|
+
|
44
|
+
Future versions will probably have a threadsafe way of caching the parsed css files since you generally only have a couple of different css sources.
|
45
|
+
|
46
|
+
Future versions will also explore the possiblity of applying the rules to the DOM with raw java code to see how much of that time we can eliminate.
|
data/lib/derelicte.rb
CHANGED
data/lib/derelicte/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Derelicte do
|
4
|
+
subject { ::Derelicte }
|
5
|
+
let(:html) { 'html' }
|
6
|
+
let(:css) { 'css' }
|
7
|
+
let(:inlined) { 'inlined' }
|
8
|
+
let(:inliner) { ::Derelicte::Inliner.new }
|
9
|
+
|
10
|
+
it "has a convenience method for doing inlining" do
|
11
|
+
inliner.better_receive(:inline)
|
12
|
+
.with(html, css).and_return(inlined)
|
13
|
+
|
14
|
+
::Derelicte::Inliner.better_receive(:new)
|
15
|
+
.with().and_return( inliner )
|
16
|
+
|
17
|
+
expect(subject.inline(html, css)).to eq(inlined)
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Michael Ries
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- spec/files/simple_dom.html
|
116
116
|
- spec/files/xhtml_dom.html
|
117
117
|
- spec/lib/derelicte/inliner_spec.rb
|
118
|
+
- spec/lib/derelicte_spec.rb
|
118
119
|
- spec/spec_helper.rb
|
119
120
|
homepage: https://github.com/hqmq/derelicte
|
120
121
|
licenses:
|
@@ -150,4 +151,5 @@ test_files:
|
|
150
151
|
- spec/files/simple_dom.html
|
151
152
|
- spec/files/xhtml_dom.html
|
152
153
|
- spec/lib/derelicte/inliner_spec.rb
|
154
|
+
- spec/lib/derelicte_spec.rb
|
153
155
|
- spec/spec_helper.rb
|