eyeliner 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  class Eyeliner
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/eyeliner.rb CHANGED
@@ -65,6 +65,7 @@ class Eyeliner
65
65
 
66
66
  def extract_stylesheets
67
67
  @doc.css("style, link[rel=stylesheet][type='text/css']").each do |element|
68
+ next if element["class"] && element["class"].split.member?("noinline")
68
69
  case element.name
69
70
  when "style"
70
71
  @css << element.content
@@ -162,6 +162,46 @@ describe Eyeliner do
162
162
 
163
163
  end
164
164
 
165
+ context "when the document contains a <style> block, classed noinline" do
166
+
167
+ before do
168
+ @input = <<-HTML
169
+ <html>
170
+ <head>
171
+ <style class="noinline">
172
+ strong { text-decoration: underline; }
173
+ </style>
174
+ </head>
175
+ <body>
176
+ <p>
177
+ Feeling <strong>STRONG</strong>.
178
+ </p>
179
+ </body>
180
+ </html>
181
+ HTML
182
+ end
183
+
184
+ describe "#apply_to" do
185
+
186
+ before do
187
+ @output = eyeliner.apply_to(@input)
188
+ @output_doc = Nokogiri::HTML.fragment(@output)
189
+ end
190
+
191
+ it "does not inline the styles" do
192
+ strong_element = @output_doc.css("strong").first
193
+ strong_element["style"].should_not == "text-decoration: underline;"
194
+ end
195
+
196
+ it "does not remove the <style> element" do
197
+ @output_doc.css("style").should_not be_empty
198
+ end
199
+
200
+ end
201
+
202
+ end
203
+
204
+
165
205
  context "when the document contains a linked stylesheet" do
166
206
 
167
207
  before do
metadata CHANGED
@@ -1,51 +1,47 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: eyeliner
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
4
5
  prerelease:
5
- version: 0.0.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Mike Williams
9
9
  - Rob Mitchell
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
-
14
- date: 2011-07-19 00:00:00 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+ date: 2011-09-08 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: nokogiri
18
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &70147027952980 !ruby/object:Gem::Requirement
19
18
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
23
22
  version: 1.4.4
24
23
  type: :runtime
25
24
  prerelease: false
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
25
+ version_requirements: *70147027952980
26
+ - !ruby/object:Gem::Dependency
28
27
  name: css_parser
29
- requirement: &id002 !ruby/object:Gem::Requirement
28
+ requirement: &70147027951940 !ruby/object:Gem::Requirement
30
29
  none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
34
33
  version: 1.1.9
35
34
  type: :runtime
36
35
  prerelease: false
37
- version_requirements: *id002
36
+ version_requirements: *70147027951940
38
37
  description:
39
- email:
38
+ email:
40
39
  - mike@cogentconsulting.com.au
41
40
  - rob@cogentconsulting.com.au
42
41
  executables: []
43
-
44
42
  extensions: []
45
-
46
43
  extra_rdoc_files: []
47
-
48
- files:
44
+ files:
49
45
  - .gitignore
50
46
  - Gemfile
51
47
  - Rakefile
@@ -56,37 +52,34 @@ files:
56
52
  - spec/spec_helper.rb
57
53
  homepage: http://github.com/cogent/eyeliner
58
54
  licenses: []
59
-
60
55
  post_install_message:
61
56
  rdoc_options: []
62
-
63
- require_paths:
57
+ require_paths:
64
58
  - lib
65
- required_ruby_version: !ruby/object:Gem::Requirement
59
+ required_ruby_version: !ruby/object:Gem::Requirement
66
60
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- hash: -2830479909873352028
71
- segments:
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ segments:
72
66
  - 0
73
- version: "0"
74
- required_rubygems_version: !ruby/object:Gem::Requirement
67
+ hash: -140593005344463670
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
69
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- hash: -2830479909873352028
80
- segments:
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ segments:
81
75
  - 0
82
- version: "0"
76
+ hash: -140593005344463670
83
77
  requirements: []
84
-
85
78
  rubyforge_project:
86
- rubygems_version: 1.7.2
79
+ rubygems_version: 1.8.10
87
80
  signing_key:
88
81
  specification_version: 3
89
82
  summary: Eyeliner puts CSS makeup on your HTML emails.
90
- test_files:
83
+ test_files:
91
84
  - spec/eyeliner_spec.rb
92
85
  - spec/spec_helper.rb