fotonauts-premailer 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/local-premailer ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This binary used only in development environment
4
+
5
+ require 'rubygems'
6
+ $LOAD_PATH.unshift(File.expand_path('./lib', File.dirname(__FILE__)))
7
+
8
+ require 'premailer/executor'
9
+
@@ -0,0 +1,230 @@
1
+ # Capabilities of e-mail clients
2
+ #
3
+ # Sources
4
+ # * http://campaignmonitor.com/css/
5
+ # * http://www.campaignmonitor.com/blog/archives/2007/04/a_guide_to_css_support_in_emai_2.html
6
+ # * http://www.campaignmonitor.com/blog/archives/2007/11/do_image_maps_work_in_html_ema.html
7
+ # * http://www.campaignmonitor.com/blog/archives/2007/11/how_forms_perform_in_html_emai.html
8
+ # * http://www.xavierfrenette.com/articles/css-support-in-webmail/
9
+ # * http://www.email-standards.org/
10
+ # Updated 2008-08-26
11
+ #
12
+ # Support: 1 = SAFE, 2 = POOR, 3 = RISKY
13
+ elements:
14
+ map:
15
+ support: 2
16
+ unsupported_in: [GMail]
17
+ area:
18
+ support: 2
19
+ unsupported_in: [GMail]
20
+ form:
21
+ support: 3
22
+ unsupported_in: [Mobile Me, Old Yahoo, AOL, Live Mail, Outlook 07, Outlook 03]
23
+ link:
24
+ support: 2
25
+ unsupported_in: [GMail, Hotmail, Old Yahoo]
26
+ attributes:
27
+ ismap:
28
+ support: 2
29
+ unsupported_in: [GMail]
30
+ css_properties:
31
+ color:
32
+ unsupported_in: [Eudora]
33
+ support_level: 92%
34
+ support: 1
35
+ font-size:
36
+ unsupported_in: [Eudora]
37
+ support_level: 92%
38
+ support: 1
39
+ font-style:
40
+ unsupported_in: [Eudora]
41
+ support_level: 92%
42
+ support: 1
43
+ font-weight:
44
+ unsupported_in: [Eudora]
45
+ support_level: 92%
46
+ support: 1
47
+ text-align:
48
+ unsupported_in: [Eudora]
49
+ support_level: 92%
50
+ support: 1
51
+ text-decoration:
52
+ unsupported_in: [Eudora]
53
+ support_level: 92%
54
+ support: 1
55
+ background-color:
56
+ unsupported_in: [Notes 6, Eudora]
57
+ support_level: 85%
58
+ support: 2
59
+ border: &border_shorthand
60
+ unsupported_in: [Notes 6, Eudora]
61
+ support_level: 85%
62
+ support: 2
63
+ border-bottom: *border_shorthand
64
+ border-left: *border_shorthand
65
+ border-right: *border_shorthand
66
+ border-top: *border_shorthand
67
+ display:
68
+ unsupported_in: [Outlook 07, Eudora]
69
+ support_level: 85%
70
+ support: 2
71
+ font-family:
72
+ unsupported_in: [Eudora, Old GMail, New GMail]
73
+ support_level: 92%
74
+ support: 2
75
+ font-variant:
76
+ unsupported_in: [Notes 6, Eudora]
77
+ support_level: 85%
78
+ support: 2
79
+ letter-spacing:
80
+ unsupported_in: [Notes 6, Eudora]
81
+ support_level: 85%
82
+ support: 2
83
+ line-height:
84
+ unsupported_in: [Notes 6, Eudora]
85
+ support_level: 85%
86
+ support: 2
87
+ padding: &padding_shorthand
88
+ unsupported_in: [Notes 6, Eudora]
89
+ support_level: 85%
90
+ support: 2
91
+ padding-bottom: *padding_shorthand
92
+ padding-left: *padding_shorthand
93
+ padding-right: *padding_shorthand
94
+ padding-top: *padding_shorthand
95
+ table-layout:
96
+ unsupported_in: [Notes 6, Eudora]
97
+ support_level: 85%
98
+ support: 2
99
+ text-indent:
100
+ unsupported_in: [Notes 6, Eudora]
101
+ support_level: 85%
102
+ support: 2
103
+ text-transform:
104
+ unsupported_in: [Notes 6, Eudora]
105
+ support_level: 85%
106
+ support: 2
107
+ border-collapse:
108
+ unsupported_in: [Entourage 2004, Notes 6, Eudora]
109
+ support_level: 77%
110
+ support: 3
111
+ clear:
112
+ unsupported_in: [Outlook 07, Notes 6, Eudora]
113
+ support_level: 77%
114
+ support: 3
115
+ direction:
116
+ unsupported_in: [Outlook 07, Entourage 2004, Eudora, New GMail]
117
+ support_level: 77%
118
+ support: 3
119
+ float:
120
+ unsupported_in: [Outlook 07, Eudora, Old GMail]
121
+ support_level: 85%
122
+ support: 3
123
+ vertical-align:
124
+ unsupported_in: [Outlook 07, Notes 6, Eudora]
125
+ support_level: 77%
126
+ support: 3
127
+ width:
128
+ unsupported_in: [Outlook 07, Notes 6, Eudora]
129
+ support_level: 77%
130
+ support: 3
131
+ word-spacing:
132
+ unsupported_in: [Outlook 07, Notes 6, Eudora]
133
+ support_level: 77%
134
+ support: 3
135
+ height:
136
+ unsupported_in: [Outlook 07, Notes 6, Eudora, Old GMail]
137
+ support_level: 77%
138
+ support: 3
139
+ list-style-type:
140
+ unsupported_in: [Outlook 07, Eudora, Hotmail]
141
+ support_level: 85%
142
+ support: 3
143
+ overflow:
144
+ unsupported_in: [Outlook 07, Entourage 2004, Notes 6, Eudora]
145
+ support_level: 69%
146
+ support: 3
147
+ visibility:
148
+ unsupported_in: [Outlook 07, Notes 6, Eudora, Old GMail, New GMail, aolWeb]
149
+ support_level: 77%
150
+ support: 3
151
+ white-space:
152
+ unsupported_in: [Outlook 03, Windows Mail, AOL 9, AOL 10, Notes 6, Eudora, Mobile Me]
153
+ support_level: 54%
154
+ support: 3
155
+ background-image:
156
+ unsupported_in: [Outlook 07, Notes 6, Eudora, Old GMail, New GMail, Live Mail]
157
+ support_level: 77%
158
+ support: 3
159
+ background-repeat:
160
+ unsupported_in: [Outlook 07, Notes 6, Eudora, Old GMail, New GMail, Live Mail]
161
+ support_level: 77%
162
+ support: 3
163
+ clip:
164
+ unsupported_in: [Outlook 07, Notes 6, Eudora, New Yahoo, New GMail, Live Mail, Mobile Me]
165
+ support_level: 77%
166
+ support: 3
167
+ cursor:
168
+ unsupported_in: [Outlook 07, Entourage 2004, Notes 6, Eudora, Old GMail, New GMail]
169
+ support_level: 69%
170
+ support: 3
171
+ list-style-image:
172
+ unsupported_in: [Outlook 07, Notes 6, Eudora, Old GMail, New GMail, Live Mail]
173
+ support_level: 77%
174
+ support: 3
175
+ list-style-position:
176
+ unsupported_in: [Outlook 07, Notes 6, Eudora, Old Yahoo, Hotmail]
177
+ support_level: 77%
178
+ support: 3
179
+ margin: &margin_shorthand
180
+ unsupported_in: [AOL 9, Notes 6, Eudora, Live Mail, Hotmail]
181
+ support_level: 77%
182
+ support: 3
183
+ margin-bottom: *margin_shorthand
184
+ margin-left: *margin_shorthand
185
+ margin-right: *margin_shorthand
186
+ margin-top: *margin_shorthand
187
+ z-index:
188
+ unsupported_in: [Notes 6, Eudora, New Yahoo, Old GMail, New GMail, Live Mail]
189
+ support_level: 85%
190
+ support: 3
191
+ left:
192
+ unsupported_in: [Outlook 07, Notes 6, Eudora, New Yahoo, Old GMail, New GMail, Live Mail]
193
+ support_level: 77%
194
+ support: 3
195
+ right:
196
+ unsupported_in: [Outlook 07, Notes 6, Eudora, New Yahoo, Old GMail, New GMail, Live Mail]
197
+ support_level: 77%
198
+ support: 3
199
+ top:
200
+ unsupported_in: [Outlook 07, Notes 6, Eudora, New Yahoo, Old GMail, New GMail, Live Mail]
201
+ support_level: 77%
202
+ support: 3
203
+ background-position:
204
+ unsupported_in: [Outlook 07, Notes 6, Eudora, Old Yahoo, Old GMail, New GMail, Live Mail, Hotmail]
205
+ support_level: 77%
206
+ support: 3
207
+ border-spacing:
208
+ unsupported_in: [Outlook 03, Outlook 07, Windows Mail, Entourage 2004, AOL 10, Notes 6, Eudora, Live Mail, Hotmail]
209
+ support_level: 46%
210
+ support: 3
211
+ bottom:
212
+ unsupported_in: [Outlook 07, AOL 9, Notes 6, Eudora, New Yahoo, Old GMail, New GMail, Live Mail]
213
+ support_level: 69%
214
+ support: 3
215
+ empty-cells:
216
+ unsupported_in: [Outlook 03, Outlook 07, Windows Mail, Entourage 2004, AOL 9, AOL 10, Notes 6, Eudora, Hotmail]
217
+ support_level: 38%
218
+ support: 3
219
+ position:
220
+ unsupported_in: [Outlook 07, Notes 6, Eudora, Old Yahoo, New Yahoo, Old GMail, New GMail, Live Mail, Hotmail, Mobile Me]
221
+ support_level: 77%
222
+ support: 3
223
+ caption-side:
224
+ unsupported_in: [Outlook 03, Outlook 07, Windows Mail, Mac Mail, Entourage 2004, Entourage 2008, AOL 9, AOL 10, AOL Desktop for Mac, Notes 6, Eudora, New Yahoo, Hotmail]
225
+ support_level: 15%
226
+ support: 3
227
+ opacity:
228
+ unsupported_in: [Outlook 03, Outlook 07, Windows Mail, Entourage 2004, Notes 6, Eudora, New Yahoo, Old GMail, New GMail, Live Mail, Hotmail]
229
+ support_level: 54%
230
+ support: 3
data/premailer.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "fotonauts-premailer"
3
+ s.version = "1.7.3"
4
+ s.date = Time.now.strftime('%Y-%m-%d')
5
+ s.summary = "Preflight for HTML e-mail."
6
+ s.email = "code@dunae.ca"
7
+ s.homepage = "http://premailer.dialect.ca/"
8
+ s.description = "Improve the rendering of HTML emails by making CSS inline, converting links and warning about unsupported code."
9
+ s.has_rdoc = true
10
+ s.author = "Alex Dunae"
11
+ s.rdoc_options << '--all' << '--inline-source' << '--line-numbers' << '--charset' << 'utf-8'
12
+ s.extra_rdoc_files = ["README.rdoc"]
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
16
+ s.add_dependency('css_parser', '>= 1.1.9')
17
+ s.add_dependency('htmlentities', '>= 4.0.0')
18
+ s.add_development_dependency('hpricot', '>= 0.8.3')
19
+ s.add_development_dependency('nokogiri', '>= 1.4.4')
20
+ s.add_development_dependency('rake', ['~> 0.8', '!= 0.9.0'])
21
+ s.add_development_dependency('rdoc', '>= 2.4.2')
22
+ end
data/rakefile.rb ADDED
@@ -0,0 +1,68 @@
1
+ $:.unshift File.expand_path('../lib', __FILE__)
2
+
3
+ require 'rake'
4
+ require 'rake/testtask'
5
+ require 'rdoc/task'
6
+ require 'rubygems/package_task'
7
+ require 'fileutils'
8
+ require 'premailer'
9
+
10
+ def gemspec
11
+ @gemspec ||= begin
12
+ file = File.expand_path('../premailer.gemspec', __FILE__)
13
+ eval(File.read(file), binding, file)
14
+ end
15
+ end
16
+
17
+ Gem::PackageTask.new(gemspec) do |pkg|
18
+ pkg.need_tar = true
19
+ end
20
+
21
+ task :default => [:test]
22
+
23
+ desc 'Parse a URL and write out the output.'
24
+ task :inline do
25
+ url = ENV['url']
26
+ output = ENV['output']
27
+
28
+ if !url or url.empty? or !output or output.empty?
29
+ puts 'Usage: rake inline url=http://example.com/ output=output.html'
30
+ exit
31
+ end
32
+
33
+ premailer = Premailer.new(url, :warn_level => Premailer::Warnings::SAFE, :verbose => true, :adapter => :nokogiri)
34
+ fout = File.open(output, "w")
35
+ fout.puts premailer.to_inline_css
36
+ fout.close
37
+
38
+ puts "Succesfully parsed '#{url}' into '#{output}'"
39
+ puts premailer.warnings.length.to_s + ' CSS warnings were found'
40
+ end
41
+
42
+ task :text do
43
+ url = ENV['url']
44
+ output = ENV['output']
45
+
46
+ if !url or url.empty? or !output or output.empty?
47
+ puts 'Usage: rake text url=http://example.com/ output=output.txt'
48
+ exit
49
+ end
50
+
51
+ premailer = Premailer.new(url, :warn_level => Premailer::Warnings::SAFE)
52
+ fout = File.open(output, "w")
53
+ fout.puts premailer.to_plain_text
54
+ fout.close
55
+
56
+ puts "Succesfully parsed '#{url}' into '#{output}'"
57
+ end
58
+
59
+ Rake::TestTask.new do |t|
60
+ t.test_files = FileList['test/test_*.rb']
61
+ t.verbose = false
62
+ end
63
+
64
+ RDoc::Task.new do |rd|
65
+ rd.main = "README.rdoc"
66
+ rd.rdoc_files.include("README.rdoc", "LICENSE.rdoc", "lib/**/*.rb")
67
+ rd.title = 'Premailer Documentation'
68
+ end
@@ -0,0 +1,142 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <!--
3
+
4
+ You can read this newsletter online at
5
+ [webversion]
6
+
7
+ -->
8
+ <html>
9
+ <head>
10
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
11
+ <title>Premailer Test</title>
12
+ <link rel="stylesheet" type="text/css" href="styles.css">
13
+ <style type="text/css">
14
+ @import "import.css" screen, handheld;
15
+ </style>
16
+ <style type="text/css">
17
+ @import "noimport.css" print;
18
+ </style>
19
+ <style type="text/css">
20
+ @media only screen and (max-device-width: 480px) {
21
+ #iphone { display: block; }
22
+ }
23
+ </style>
24
+ </head>
25
+ <body>
26
+ <div id="wrapper">
27
+ <p class="hide" id="hide01">This line should be hidden.</p>
28
+ <p class="hide" id="iphone">This is an iPhone style.</p>
29
+ <table width="646" class="container" cellspacing="0" cellpadding="0">
30
+ <tr><td id="webversion" colspan="6">Having trouble reading this newsletter? <webversion>Click here to see it in your browser</webversion></td></tr>
31
+
32
+ <tr><td height="13" colspan="6" class="frame">&#x00a0;</td></tr>
33
+
34
+
35
+
36
+ <table width="646" class="container" cellspacing="0" cellpadding="0">
37
+
38
+ <tr>
39
+ <td class="frame" width="13">&#x00a0;</td>
40
+ <td class="gutter" width="60">&#x00a0;</td>
41
+
42
+ <td class="content" colspan="2" width="500">
43
+
44
+ <h1><span>Premailer Test</span></h1>
45
+
46
+ <table width="500" cellpadding="0" cellspacing="0">
47
+ <tr>
48
+ <td width="20">&#x00a0;</td>
49
+ <td colspan="2" width="460">
50
+ <h2>Lorem ipsum dolor</h2>
51
+ <h3>Suspendisse id velit vitae ligula volutpat condimentum</h3>
52
+ <p class="dt">Morbi commodo, ipsum sed</p>
53
+
54
+
55
+ <p class="unaligned"><img src="2009-placeholder.png" alt="Image" align="right" class="right">Lorem&nbsp;ipsum&#x00a0;dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. <a href="http://premailer.dialect.ca/">Nulla facilisi</a>. Nulla libero.</p>
56
+
57
+ <p attr="another quote">Here&rsquo;s a quote. Here’s a quote. &#x201c;Here’s a quote in quotes”.</p>
58
+
59
+ <p>Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi.</p>
60
+ <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero.</p>
61
+ <blockquote><p>“Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis.”</p></blockquote>
62
+ <p>Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero.</p>
63
+
64
+ <h3>Link tests</h3>
65
+ <ul>
66
+ <li><a id="l01" href="/">Relative path to root</a></li>
67
+ <li><a id="l02" href="http://premailer.dialect.ca/">Absolute path to root</a></li>
68
+ <li><a id="l03" href="http://example.com/">Different domain</a></li>
69
+ <li><a id="l04" href="images/">Relative path to sub-directory</a></li>
70
+ <li><a id="l05" href="#relative">Link is not converted</a></li>
71
+ <li><a id="l06" href="http://example.com/test.html?cn=tf&amp;c=20&amp;ord=%%RANDOM%%">Funky ASP URL</a></li>
72
+ <li><a id="l07" href="?query=string">Appends tracking query string</a></li>
73
+ <li><a id="l08" href="{DONOTCONVERT}">Link is not converted</a></li>
74
+ <li><a id="l09" href="[DONOTCONVERT]">Link is not converted</a></li>
75
+ <li><a id="l10" href="<DONOTCONVERT>">Link is not converted</a></li>
76
+ <li><a id="l11" href="mailto:premailer@example.com">mailto link</a></li>
77
+ <li><a id="l12" href="ftp://example.com">FTP link</a></li>
78
+ <li><a id="l13" href="gopher://gopher.floodgap.com/1/fun/twitpher">Gopher link</a></li>
79
+ </ul>
80
+
81
+
82
+
83
+ <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis.</p>
84
+
85
+ <p>&nbsp;</p>
86
+
87
+
88
+ </td>
89
+ <td width="20">&#x00a0;</td>
90
+ </tr>
91
+ </table>
92
+
93
+ <p class="section"><img src="dots_end.png" alt="---" width="499" height="75"></p>
94
+ </td><!-- /#content -->
95
+ <td class="gutter" width="60">&#x00a0;</td>
96
+
97
+ <td class="frame" width="13">&#x00a0;</td>
98
+ </tr>
99
+
100
+ <tr>
101
+ <td class="frame" width="13">&#x00a0;</td>
102
+ <td colspan="4" width="620">
103
+ <table summary="Contact information" cellspacing="0" cellpadding="0" width="620">
104
+ <tr><td height="4" class="hairline">&#x00a0;</td></tr>
105
+ <tr><td height="34"class="contact">&#x00a0;</td></tr>
106
+ <tr>
107
+
108
+ <td align="center" class="contact" id="contact_info">
109
+ <p id="address">Premailer Test<br>
110
+ <a href="http://dialect.ca/?utm_source=Premailer&utm_medium=Test+Suite&utm_campaign=Premailer">by Dialect</a><br>
111
+ Vancouver Island, British Columbia<br>
112
+ 250 555.2222</p>
113
+ </td>
114
+
115
+ </tr>
116
+ <tr><td height="34"class="contact">&#x00a0;</td></tr>
117
+ <tr><td height="4" class="hairline">&#x00a0;</td></tr>
118
+ </table>
119
+ </td>
120
+ <td class="frame" width="13">&#x00a0;</td>
121
+ </tr>
122
+
123
+ <tr>
124
+ <td class="frame" width="13">&#x00a0;</td>
125
+
126
+ <td colspan="4" class="content" height="60">&#x00a0;</td>
127
+ <td class="frame" width="13">&#x00a0;</td>
128
+ </tr>
129
+
130
+
131
+
132
+
133
+
134
+ <tr><td height="13" colspan="6" class="frame">&#x00a0;</td></tr>
135
+ <tr><td height="22" colspan="6" >&#x00a0;</td></tr>
136
+ <tr><td id="credit" colspan="6">Newsletter communications by<br><a href="http://dialect.ca/dialogue/?utm_source=Dialogue&utm_medium=Credit&utm_campaign=South+Hollow"><img src="inc/dialect.png" alt="Dialect" width="60" height="35" border="0"></a><br><unsubscribe>Click here to unsubscribe</unsubscribe></td></tr>
137
+
138
+ </table>
139
+
140
+ </div>
141
+ </body>
142
+ </html>