premailer 1.7.3 → 1.7.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -1
- data/.jrubyrc +1 -0
- data/.travis.yml +9 -0
- data/.yardopts +10 -0
- data/Gemfile +12 -1
- data/{LICENSE.rdoc → LICENSE.md} +2 -2
- data/README.md +100 -0
- data/lib/premailer/adapter.rb +14 -10
- data/lib/premailer/adapter/hpricot.rb +22 -16
- data/lib/premailer/adapter/nokogiri.rb +46 -18
- data/lib/premailer/executor.rb +4 -0
- data/lib/premailer/html_to_plain_text.rb +28 -12
- data/lib/premailer/premailer.rb +135 -63
- data/lib/premailer/version.rb +4 -0
- data/premailer.gemspec +14 -5
- data/rakefile.rb +20 -25
- data/test/files/html_with_uri.html +9 -0
- data/test/future_tests.rb +1 -1
- data/test/helper.rb +34 -1
- data/test/test_adapter.rb +1 -1
- data/test/test_html_to_plain_text.rb +25 -2
- data/test/test_links.rb +45 -1
- data/test/test_misc.rb +50 -5
- data/test/test_premailer.rb +60 -39
- data/test/test_warnings.rb +1 -3
- metadata +165 -131
- data/README.rdoc +0 -85
data/test/test_warnings.rb
CHANGED
metadata
CHANGED
@@ -1,138 +1,181 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: premailer
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.7.8
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 7
|
9
|
-
- 3
|
10
|
-
version: 1.7.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Alex Dunae
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: css_parser
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 1
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 1
|
32
|
-
- 9
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 1.1.9
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: htmlentities
|
38
23
|
prerelease: false
|
39
|
-
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.1.9
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: htmlentities
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
49
37
|
version: 4.0.0
|
50
38
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: hpricot
|
54
39
|
prerelease: false
|
55
|
-
|
56
|
-
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 4.0.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.3'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.8'
|
70
|
+
- - ! '!='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 0.9.0
|
73
|
+
type: :development
|
74
|
+
prerelease: false
|
75
|
+
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ~>
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0.8'
|
81
|
+
- - ! '!='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.9.0
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: hpricot
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
65
91
|
version: 0.8.3
|
66
92
|
type: :development
|
67
|
-
|
68
|
-
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 0.8.3
|
100
|
+
- !ruby/object:Gem::Dependency
|
69
101
|
name: nokogiri
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: 1.4.4
|
108
|
+
type: :development
|
70
109
|
prerelease: false
|
71
|
-
|
72
|
-
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
hash: 15
|
77
|
-
segments:
|
78
|
-
- 1
|
79
|
-
- 4
|
80
|
-
- 4
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
81
115
|
version: 1.4.4
|
116
|
+
- !ruby/object:Gem::Dependency
|
117
|
+
name: yard
|
118
|
+
requirement: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ~>
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 0.8.7
|
82
124
|
type: :development
|
83
|
-
version_requirements: *id004
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rake
|
86
125
|
prerelease: false
|
87
|
-
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
127
|
none: false
|
89
|
-
requirements:
|
128
|
+
requirements:
|
90
129
|
- - ~>
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
- 0
|
102
|
-
- 9
|
103
|
-
- 0
|
104
|
-
version: 0.9.0
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.8.7
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: redcarpet
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ~>
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '3.0'
|
105
140
|
type: :development
|
106
|
-
version_requirements: *id005
|
107
|
-
- !ruby/object:Gem::Dependency
|
108
|
-
name: rdoc
|
109
141
|
prerelease: false
|
110
|
-
|
111
|
-
none: false
|
112
|
-
requirements:
|
113
|
-
- -
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
142
|
+
version_requirements: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ~>
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '3.0'
|
148
|
+
- !ruby/object:Gem::Dependency
|
149
|
+
name: yard-redcarpet-ext
|
150
|
+
requirement: !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ~>
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: 0.0.3
|
121
156
|
type: :development
|
122
|
-
|
123
|
-
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
|
+
requirements:
|
161
|
+
- - ~>
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: 0.0.3
|
164
|
+
description: Improve the rendering of HTML emails by making CSS inline, converting
|
165
|
+
links and warning about unsupported code.
|
124
166
|
email: code@dunae.ca
|
125
|
-
executables:
|
167
|
+
executables:
|
126
168
|
- premailer
|
127
169
|
extensions: []
|
128
|
-
|
129
|
-
|
130
|
-
- README.rdoc
|
131
|
-
files:
|
170
|
+
extra_rdoc_files: []
|
171
|
+
files:
|
132
172
|
- .gitignore
|
173
|
+
- .jrubyrc
|
174
|
+
- .travis.yml
|
175
|
+
- .yardopts
|
133
176
|
- Gemfile
|
134
|
-
- LICENSE.
|
135
|
-
- README.
|
177
|
+
- LICENSE.md
|
178
|
+
- README.md
|
136
179
|
- bin/premailer
|
137
180
|
- init.rb
|
138
181
|
- lib/premailer.rb
|
@@ -142,6 +185,7 @@ files:
|
|
142
185
|
- lib/premailer/executor.rb
|
143
186
|
- lib/premailer/html_to_plain_text.rb
|
144
187
|
- lib/premailer/premailer.rb
|
188
|
+
- lib/premailer/version.rb
|
145
189
|
- local-premailer
|
146
190
|
- misc/client_support.yaml
|
147
191
|
- premailer.gemspec
|
@@ -153,6 +197,7 @@ files:
|
|
153
197
|
- test/files/dots_end.png
|
154
198
|
- test/files/dots_h.gif
|
155
199
|
- test/files/html4.html
|
200
|
+
- test/files/html_with_uri.html
|
156
201
|
- test/files/import.css
|
157
202
|
- test/files/inc/2009-placeholder.png
|
158
203
|
- test/files/iso-8859-2.html
|
@@ -171,42 +216,29 @@ files:
|
|
171
216
|
- test/test_warnings.rb
|
172
217
|
homepage: http://premailer.dialect.ca/
|
173
218
|
licenses: []
|
174
|
-
|
175
219
|
post_install_message:
|
176
|
-
rdoc_options:
|
177
|
-
|
178
|
-
- --inline-source
|
179
|
-
- --line-numbers
|
180
|
-
- --charset
|
181
|
-
- utf-8
|
182
|
-
require_paths:
|
220
|
+
rdoc_options: []
|
221
|
+
require_paths:
|
183
222
|
- lib
|
184
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
223
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
185
224
|
none: false
|
186
|
-
requirements:
|
187
|
-
- -
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
|
190
|
-
|
191
|
-
- 0
|
192
|
-
version: "0"
|
193
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - ! '>='
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0'
|
229
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
230
|
none: false
|
195
|
-
requirements:
|
196
|
-
- -
|
197
|
-
- !ruby/object:Gem::Version
|
198
|
-
|
199
|
-
segments:
|
200
|
-
- 0
|
201
|
-
version: "0"
|
231
|
+
requirements:
|
232
|
+
- - ! '>='
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: '0'
|
202
235
|
requirements: []
|
203
|
-
|
204
236
|
rubyforge_project:
|
205
|
-
rubygems_version: 1.8.
|
237
|
+
rubygems_version: 1.8.24
|
206
238
|
signing_key:
|
207
239
|
specification_version: 3
|
208
240
|
summary: Preflight for HTML e-mail.
|
209
|
-
test_files:
|
241
|
+
test_files:
|
210
242
|
- test/files/base.html
|
211
243
|
- test/files/chars.html
|
212
244
|
- test/files/contact_bg.png
|
@@ -214,6 +246,7 @@ test_files:
|
|
214
246
|
- test/files/dots_end.png
|
215
247
|
- test/files/dots_h.gif
|
216
248
|
- test/files/html4.html
|
249
|
+
- test/files/html_with_uri.html
|
217
250
|
- test/files/import.css
|
218
251
|
- test/files/inc/2009-placeholder.png
|
219
252
|
- test/files/iso-8859-2.html
|
@@ -230,3 +263,4 @@ test_files:
|
|
230
263
|
- test/test_misc.rb
|
231
264
|
- test/test_premailer.rb
|
232
265
|
- test/test_warnings.rb
|
266
|
+
has_rdoc: true
|
data/README.rdoc
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
= Premailer README
|
2
|
-
|
3
|
-
=== What is this?
|
4
|
-
|
5
|
-
For the best HTML e-mail delivery results, CSS should be inline. This is a
|
6
|
-
huge pain and a simple newsletter becomes un-managable very quickly. This
|
7
|
-
script is my solution.
|
8
|
-
|
9
|
-
* CSS styles are converted to inline style attributes
|
10
|
-
Checks <tt>style</tt> and <tt>link[rel=stylesheet]</tt> tags and preserves existing inline attributes
|
11
|
-
* Relative paths are converted to absolute paths
|
12
|
-
Checks links in <tt>href</tt>, <tt>src</tt> and CSS <tt>url('')</tt>
|
13
|
-
* CSS properties are checked against e-mail client capabilities
|
14
|
-
Based on the Email Standards Project's guides
|
15
|
-
* A plain text version is created
|
16
|
-
Optional
|
17
|
-
|
18
|
-
=== Premailer 2.0 is coming
|
19
|
-
|
20
|
-
I'm looking for input on a version 2.0 update to Premailer. PLease visit the {Premailer 2.0 Planning Page}[https://github.com/alexdunae/premailer/wiki/Premailer-2.0-Planning] and give me your feedback.
|
21
|
-
|
22
|
-
=== Installation
|
23
|
-
|
24
|
-
Download the Premailer gem from RubyGems.
|
25
|
-
|
26
|
-
sudo gem install premailer
|
27
|
-
|
28
|
-
=== Example
|
29
|
-
premailer = Premailer.new('http://example.com/myfile.html', :warn_level => Premailer::Warnings::SAFE)
|
30
|
-
|
31
|
-
# Write the HTML output
|
32
|
-
fout = File.open("output.html", "w")
|
33
|
-
fout.puts premailer.to_inline_css
|
34
|
-
fout.close
|
35
|
-
|
36
|
-
# Write the plain-text output
|
37
|
-
fout = File.open("ouput.txt", "w")
|
38
|
-
fout.puts premailer.to_plain_text
|
39
|
-
fout.close
|
40
|
-
|
41
|
-
# Output any CSS warnings
|
42
|
-
premailer.warnings.each do |w|
|
43
|
-
puts "#{w[:message]} (#{w[:level]}) may not render properly in #{w[:clients]}"
|
44
|
-
end
|
45
|
-
|
46
|
-
=== Premailer-specific CSS
|
47
|
-
|
48
|
-
Premailer looks for a few CSS attributes that make working with tables a bit easier.
|
49
|
-
|
50
|
-
+-premailer-width+:: Available on <tt>table</tt>, <tt>th</tt> and <tt>td</tt> elements
|
51
|
-
+-premailer-height+:: Available on <tt>table</tt>, <tt>tr</tt>, <tt>th</tt> and <tt>td</tt> elements
|
52
|
-
+-premailer-cellpadding+:: Available on <tt>table</tt> elements
|
53
|
-
+-premailer-cellspacing+:: Available on <tt>table</tt> elements
|
54
|
-
|
55
|
-
Each of these CSS declarations will be copied to appropriate element's attribute.
|
56
|
-
|
57
|
-
For example
|
58
|
-
|
59
|
-
table { -premailer-cellspacing: 5; -premailer-width: 500;}
|
60
|
-
|
61
|
-
will result in
|
62
|
-
|
63
|
-
<table cellspacing='5' width='500'>
|
64
|
-
|
65
|
-
|
66
|
-
=== Contributions
|
67
|
-
|
68
|
-
Contributions are most welcome. Premailer was rotting away in a private SVN repository for too long and could use some TLC. Fork and patch to your heart's content. Please don't increment the version numbers, though.
|
69
|
-
|
70
|
-
A few areas that are particularly in need of love:
|
71
|
-
* Improved test coverage
|
72
|
-
* Move un-repeated background images defined in CSS to <tt><td background=""></tt> for Outlook
|
73
|
-
|
74
|
-
=== Credits and code
|
75
|
-
|
76
|
-
Thanks to {all the wonderful contributors}[https://github.com/alexdunae/premailer/contributors] for their updates.
|
77
|
-
|
78
|
-
Thanks to {Greenhood + Company}[http://www.greenhood.com/] for sponsoring some of the 1.5.6 updates,
|
79
|
-
and to {Campaign Monitor}[http://www.campaignmonitor.com] for supporting the web interface.
|
80
|
-
|
81
|
-
The web interface can be found at {premailer.dialect.ca}[http://premailer.dialect.ca].
|
82
|
-
|
83
|
-
The source code can be found on {GitHub}[https://github.com/alexdunae/premailer].
|
84
|
-
|
85
|
-
Copyright by Alex Dunae (dunae.ca, e-mail 'code' at the same domain), 2007-2011. See LICENSE.rdoc for license details.
|