html2email 0.1.2
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.
- data/.gitignore +1 -0
- data/LICENSE +23 -0
- data/README.markdown +110 -0
- data/Rakefile +57 -0
- data/bin/html2email +5 -0
- data/html2email.gemspec +47 -0
- data/lib/html2email/context.rb +42 -0
- data/lib/html2email/html_email.rb +59 -0
- data/lib/html2email/html_mailer.rb +49 -0
- data/lib/html2email/vendor/premailer/.gitignore +1 -0
- data/lib/html2email/vendor/premailer/CHANGELOG.rdoc +62 -0
- data/lib/html2email/vendor/premailer/LICENSE.rdoc +42 -0
- data/lib/html2email/vendor/premailer/README.rdoc +66 -0
- data/lib/html2email/vendor/premailer/bin/premailer +72 -0
- data/lib/html2email/vendor/premailer/bin/trollop.rb +739 -0
- data/lib/html2email/vendor/premailer/init.rb +1 -0
- data/lib/html2email/vendor/premailer/lib/premailer/html_to_plain_text.rb +81 -0
- data/lib/html2email/vendor/premailer/lib/premailer/premailer.rb +464 -0
- data/lib/html2email/vendor/premailer/lib/premailer.rb +9 -0
- data/lib/html2email/vendor/premailer/misc/client_support.yaml +230 -0
- data/lib/html2email/vendor/premailer/premailer.gemspec +20 -0
- data/lib/html2email/vendor/premailer/rakefile.rb +42 -0
- data/lib/html2email/vendor/premailer/tests/files/base.html +145 -0
- data/lib/html2email/vendor/premailer/tests/files/contact_bg.png +0 -0
- data/lib/html2email/vendor/premailer/tests/files/dialect.png +0 -0
- data/lib/html2email/vendor/premailer/tests/files/dots_end.png +0 -0
- data/lib/html2email/vendor/premailer/tests/files/dots_h.gif +0 -0
- data/lib/html2email/vendor/premailer/tests/files/import.css +13 -0
- data/lib/html2email/vendor/premailer/tests/files/inc/2009-placeholder.png +0 -0
- data/lib/html2email/vendor/premailer/tests/files/noimport.css +13 -0
- data/lib/html2email/vendor/premailer/tests/files/styles.css +102 -0
- data/lib/html2email/vendor/premailer/tests/test_helper.rb +2 -0
- data/lib/html2email/vendor/premailer/tests/test_html_to_plain_text.rb +73 -0
- data/lib/html2email/vendor/premailer/tests/test_link_resolver.rb +49 -0
- data/lib/html2email/vendor/premailer/tests/test_premailer.rb +124 -0
- data/lib/html2email.rb +110 -0
- data/spec/html2email.spec.rb +9 -0
- metadata +176 -0
@@ -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
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "premailer"
|
5
|
+
s.version = "1.5.5"
|
6
|
+
s.date = "2009-12-03"
|
7
|
+
s.summary = "Preflight for HTML e-mail."
|
8
|
+
s.email = "code@dunae.ca"
|
9
|
+
s.homepage = "http://premailer.dialect.ca/"
|
10
|
+
s.description = "Improve the rendering of HTML emails by making CSS inline, converting links and warning about unsupported code."
|
11
|
+
s.has_rdoc = true
|
12
|
+
s.author = "Alex Dunae"
|
13
|
+
s.rdoc_options << '--all' << '--inline-source' << '--line-numbers' << '--charset' << 'utf-8'
|
14
|
+
s.files = FileList['*.rb', 'lib/premailer.rb', 'lib/**/*', '*.rdoc', 'misc/client_support.yaml', 'bin/*', 'test/*', 'test/**/*'].to_a
|
15
|
+
s.executables = 'premailer'
|
16
|
+
s.add_dependency('hpricot', '>= 0.6')
|
17
|
+
s.add_dependency('css_parser', '>= 0.9.1')
|
18
|
+
s.add_dependency('text-reform', '>= 0.2.0')
|
19
|
+
s.add_dependency('htmlentities', '>= 4.0.0')
|
20
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'fileutils'
|
3
|
+
require File.expand_path '../lib/premailer', __FILE__
|
4
|
+
|
5
|
+
desc 'Default: parse a URL.'
|
6
|
+
task :default => [:inline]
|
7
|
+
|
8
|
+
desc 'Parse a URL and write out the output.'
|
9
|
+
task :inline do
|
10
|
+
url = ENV['url']
|
11
|
+
output = ENV['output']
|
12
|
+
|
13
|
+
if !url or url.empty? or !output or output.empty?
|
14
|
+
puts 'Usage: rake inline url=http://example.com/ output=output.html'
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
premailer = Premailer.new(url, :warn_level => Premailer::Warnings::SAFE)
|
19
|
+
fout = File.open(output, "w")
|
20
|
+
fout.puts premailer.to_inline_css
|
21
|
+
fout.close
|
22
|
+
|
23
|
+
puts "Succesfully parsed '#{url}' into '#{output}'"
|
24
|
+
puts premailer.warnings.length.to_s + ' CSS warnings were found'
|
25
|
+
end
|
26
|
+
|
27
|
+
task :text do
|
28
|
+
url = ENV['url']
|
29
|
+
output = ENV['output']
|
30
|
+
|
31
|
+
if !url or url.empty? or !output or output.empty?
|
32
|
+
puts 'Usage: rake text url=http://example.com/ output=output.txt'
|
33
|
+
exit
|
34
|
+
end
|
35
|
+
|
36
|
+
premailer = Premailer.new(url, :warn_level => Premailer::Warnings::SAFE)
|
37
|
+
fout = File.open(output, "w")
|
38
|
+
fout.puts premailer.to_plain_text
|
39
|
+
fout.close
|
40
|
+
|
41
|
+
puts "Succesfully parsed '#{url}' into '#{output}'"
|
42
|
+
end
|
@@ -0,0 +1,145 @@
|
|
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"> </td></tr>
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
<table width="646" class="container" cellspacing="0" cellpadding="0">
|
37
|
+
|
38
|
+
<tr>
|
39
|
+
<td class="frame" width="13"> </td>
|
40
|
+
<td class="gutter" width="60"> </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"> </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 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. <a href="http://premailer.dialect.ca/">Nulla facilisi</a>. Nulla libero.</p>
|
56
|
+
|
57
|
+
<p>Here’s a quote. Here’s a quote. “Here’s a quote in quotes”.</p>
|
58
|
+
|
59
|
+
<p id="accents">cédille cé garçon garçon à à</p>
|
60
|
+
|
61
|
+
|
62
|
+
<p>Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi.</p>
|
63
|
+
<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>
|
64
|
+
<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>
|
65
|
+
<p>Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero.</p>
|
66
|
+
|
67
|
+
<h3>Link tests</h3>
|
68
|
+
<ul>
|
69
|
+
<li><a id="l01" href="/">Relative path to root</a></li>
|
70
|
+
<li><a id="l02" href="http://premailer.dialect.ca/">Absolute path to root</a></li>
|
71
|
+
<li><a id="l03" href="http://example.com/">Different domain</a></li>
|
72
|
+
<li><a id="l04" href="images/">Relative path to sub-directory</a></li>
|
73
|
+
<li><a id="l05" href="#relative">Link is not converted</a></li>
|
74
|
+
<li><a id="l06" href="http://example.com/test.html?cn=tf&c=20&ord=%%RANDOM%%">Funky ASP URL</a></li>
|
75
|
+
<li><a id="l07" href="?query=string">Appends tracking query string</a></li>
|
76
|
+
<li><a id="l08" href="{DONOTCONVERT}">Link is not converted</a></li>
|
77
|
+
<li><a id="l09" href="[DONOTCONVERT]">Link is not converted</a></li>
|
78
|
+
<li><a id="l10" href="<DONOTCONVERT>">Link is not converted</a></li>
|
79
|
+
<li><a id="l11" href="mailto:premailer@example.com">mailto link</a></li>
|
80
|
+
<li><a id="l12" href="ftp://example.com">FTP link</a></li>
|
81
|
+
<li><a id="l13" href="gopher://gopher.floodgap.com/1/fun/twitpher">Gopher link</a></li>
|
82
|
+
</ul>
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
<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>
|
87
|
+
|
88
|
+
<p> </p>
|
89
|
+
|
90
|
+
|
91
|
+
</td>
|
92
|
+
<td width="20"> </td>
|
93
|
+
</tr>
|
94
|
+
</table>
|
95
|
+
|
96
|
+
<p class="section"><img src="dots_end.png" alt="---" width="499" height="75"></p>
|
97
|
+
</td><!-- /#content -->
|
98
|
+
<td class="gutter" width="60"> </td>
|
99
|
+
|
100
|
+
<td class="frame" width="13"> </td>
|
101
|
+
</tr>
|
102
|
+
|
103
|
+
<tr>
|
104
|
+
<td class="frame" width="13"> </td>
|
105
|
+
<td colspan="4" width="620">
|
106
|
+
<table summary="Contact information" cellspacing="0" cellpadding="0" width="620">
|
107
|
+
<tr><td height="4" class="hairline"> </td></tr>
|
108
|
+
<tr><td height="34"class="contact"> </td></tr>
|
109
|
+
<tr>
|
110
|
+
|
111
|
+
<td align="center" class="contact" id="contact_info">
|
112
|
+
<p id="address">Premailer Test<br>
|
113
|
+
<a href="http://dialect.ca/?utm_source=Premailer&utm_medium=Test+Suite&utm_campaign=Premailer">by Dialect</a><br>
|
114
|
+
Vancouver Island, British Columbia<br>
|
115
|
+
250 555.2222</p>
|
116
|
+
</td>
|
117
|
+
|
118
|
+
</tr>
|
119
|
+
<tr><td height="34"class="contact"> </td></tr>
|
120
|
+
<tr><td height="4" class="hairline"> </td></tr>
|
121
|
+
</table>
|
122
|
+
</td>
|
123
|
+
<td class="frame" width="13"> </td>
|
124
|
+
</tr>
|
125
|
+
|
126
|
+
<tr>
|
127
|
+
<td class="frame" width="13"> </td>
|
128
|
+
|
129
|
+
<td colspan="4" class="content" height="60"> </td>
|
130
|
+
<td class="frame" width="13"> </td>
|
131
|
+
</tr>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<tr><td height="13" colspan="6" class="frame"> </td></tr>
|
138
|
+
<tr><td height="22" colspan="6" > </td></tr>
|
139
|
+
<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>
|
140
|
+
|
141
|
+
</table>
|
142
|
+
|
143
|
+
</div>
|
144
|
+
</body>
|
145
|
+
</html>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* Premailer styles - should import
|
3
|
+
*
|
4
|
+
* Copyright (c) 2009 Dialect Communications Group (dialect.ca)
|
5
|
+
*
|
6
|
+
* $Package: Premailer $
|
7
|
+
* $Date: 2009-02-09 17:15:56 -0800 (Mon, 09 Feb 2009) $WCDATE$ $
|
8
|
+
* $Rev: 95 $WCREV$ $
|
9
|
+
*/
|
10
|
+
|
11
|
+
.hide {
|
12
|
+
display: none;
|
13
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* Premailer styles - should not import
|
3
|
+
*
|
4
|
+
* Copyright (c) 2009 Dialect Communications Group (dialect.ca)
|
5
|
+
*
|
6
|
+
* $Package: Premailer $
|
7
|
+
* $Date: 2009-02-09 17:15:56 -0800 (Mon, 09 Feb 2009) $WCDATE$ $
|
8
|
+
* $Rev: 95 $WCREV$ $
|
9
|
+
*/
|
10
|
+
|
11
|
+
body {
|
12
|
+
background: none red !important;
|
13
|
+
}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
/*
|
2
|
+
* Premailer styles
|
3
|
+
*
|
4
|
+
* Copyright (c) 2009 Dialect Communications Group (dialect.ca)
|
5
|
+
*
|
6
|
+
* $Package: Premailer $
|
7
|
+
* $Date: 2009-02-09 17:15:56 -0800 (Mon, 09 Feb 2009) $WCDATE$ $
|
8
|
+
* $Rev: 95 $WCREV$ $
|
9
|
+
*/
|
10
|
+
|
11
|
+
@import "noimport.css" print;
|
12
|
+
|
13
|
+
|
14
|
+
/*** structure and table cells ***/
|
15
|
+
body{font:13px/1.231 "Arial",sans-serif;color: #fff;background-color: #9EBF00;}
|
16
|
+
|
17
|
+
#wrapper { width: 100%; margin: 2em 0; background-color: #9EBF00; color: #fff; }
|
18
|
+
|
19
|
+
.container { margin: 0 auto; line-height: 130%; color: #4d4d4d; text-align: left; }
|
20
|
+
|
21
|
+
.frame { background-color: #b6d93f; font-size: 1px; line-height: 1px; }
|
22
|
+
|
23
|
+
.hairline { background-color: #9ebf00; font-size: 1px; line-height: 1px; }
|
24
|
+
|
25
|
+
.masthead, .gutter { color: #999; background-color: #fff; }
|
26
|
+
|
27
|
+
.content { line-height: 158%; color: #999; background-color: #fff; }
|
28
|
+
|
29
|
+
#webversion, #footer { margin: 0 auto; text-align: center; font-size: 85%; }
|
30
|
+
|
31
|
+
|
32
|
+
/*** general styles ***/
|
33
|
+
h1, h1 a, h2, h2 a { color: #9ebf00; }
|
34
|
+
|
35
|
+
h1 span { padding: 0 .5em; background: #fff; }
|
36
|
+
|
37
|
+
h1 {
|
38
|
+
margin: 32px 0 19px;
|
39
|
+
font: bold 85% "Verdana", sans-serif;
|
40
|
+
text-transform: uppercase;
|
41
|
+
text-align: center;
|
42
|
+
letter-spacing: .1em;
|
43
|
+
background: transparent url("dots_h.gif") repeat-x 0 55%;
|
44
|
+
}
|
45
|
+
|
46
|
+
h2 { margin: 0 0 .4em; font: normal 205%/109% "Arial", sans-serif; }
|
47
|
+
|
48
|
+
h3, h3 a { color: #808080; }
|
49
|
+
|
50
|
+
h3 { margin: 0 0 .1em; font: normal 165%/109% "Arial", sans-serif; }
|
51
|
+
|
52
|
+
table{ border-collapse:collapse;border-spacing:0; border: 0; }
|
53
|
+
|
54
|
+
caption,th,td {text-align:left;font-weight:normal; margin: 0; padding: 0; }
|
55
|
+
|
56
|
+
pre,code,kbd,samp,tt{font-family:monospace;line-height:100%;}
|
57
|
+
|
58
|
+
th, td { vertical-align: top; }
|
59
|
+
|
60
|
+
a { text-decoration: none; }
|
61
|
+
|
62
|
+
blockquote { margin: 0; padding: 5px 30px; text-align: center; }
|
63
|
+
|
64
|
+
blockquote, blockquote p { font: italic 16px/145% "Georgia", serif; }
|
65
|
+
|
66
|
+
p, blockquote { color: #999; }
|
67
|
+
|
68
|
+
p { margin: 0 0 1em; font: normal 100%/158% "Arial", sans-serif; vertical-align: top; }
|
69
|
+
|
70
|
+
|
71
|
+
.hide { text-align: center; color: red; font-size: 150%; }
|
72
|
+
|
73
|
+
/*** specific elements ***/
|
74
|
+
.content p a, .content li a { color: #8AAD09; text-decoration: underline; }
|
75
|
+
|
76
|
+
.content p.dt { margin-bottom: .8em; font: italic 95%/135% "Arial", sans-serif; }
|
77
|
+
|
78
|
+
img.right { float: right; margin: 0 0 30px 20px; }
|
79
|
+
|
80
|
+
.contact { text-align: center; background: #9EC03B url("contact_bg.png") repeat 0 0; }
|
81
|
+
|
82
|
+
.contact, .contact p, .contact a { color: #fff; text-decoration: none; }
|
83
|
+
|
84
|
+
.contact p { margin-bottom: 0; line-height: 140%; }
|
85
|
+
|
86
|
+
.contact a:hover { text-decoration: underline; }
|
87
|
+
|
88
|
+
#webversion, #webversion a {
|
89
|
+
font: bold 12px/28px "Trebuchet", "Trebuchet MS", serif;
|
90
|
+
color: #fff;
|
91
|
+
background: #9ebf00;
|
92
|
+
}
|
93
|
+
|
94
|
+
#credit { padding-bottom: 20px; }
|
95
|
+
|
96
|
+
#credit, #credit a {
|
97
|
+
color: #fff;
|
98
|
+
font: normal 10px/13px "Verdana", sans-serif;
|
99
|
+
text-align: center;
|
100
|
+
}
|
101
|
+
|
102
|
+
#contact_info { padding: 5px; }
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class TestHtmlToPlainText < Test::Unit::TestCase
|
4
|
+
include HtmlToPlainText
|
5
|
+
|
6
|
+
def test_accents
|
7
|
+
assert_plaintext 'cédille garçon à ñ', 'cédille garçon à ñ'
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_stripping_whitespace
|
11
|
+
assert_plaintext "text\ntext", " \ttext\ntext\n"
|
12
|
+
assert_plaintext "a\na", " \na \n a \t"
|
13
|
+
assert_plaintext "a\n\na", " \na \n\t \n \n a \t"
|
14
|
+
assert_plaintext "test text", "test text "
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_line_breaks
|
18
|
+
assert_plaintext "Test text\nTest text", "Test text\r\nTest text"
|
19
|
+
assert_plaintext "Test text\nTest text", "Test text\rTest text"
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_lists
|
23
|
+
assert_plaintext "* item 1\n* item 2", "<li class='123'>item 1</li> <li>item 2</li>\n"
|
24
|
+
assert_plaintext "* item 1\n* item 2\n* item 3", "<li>item 1</li> \t\n <li>item 2</li> <li> item 3</li>\n"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_stripping_html
|
28
|
+
assert_plaintext 'test text', "<p class=\"123'45 , att\" att=tester>test <span class='te\"st'>text</span>\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_paragraphs_and_breaks
|
32
|
+
assert_plaintext "Test text\n\nTest text", "<p>Test text</p><p>Test text</p>"
|
33
|
+
assert_plaintext "Test text\n\nTest text", "\n<p>Test text</p>\n\n\n\t<p>Test text</p>\n"
|
34
|
+
assert_plaintext "Test text\nTest text", "\n<p>Test text<br/>Test text</p>\n"
|
35
|
+
assert_plaintext "Test text\nTest text", "\n<p>Test text<br> \tTest text<br></p>\n"
|
36
|
+
assert_plaintext "Test text\n\nTest text", "Test text<br><BR />Test text"
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_headings
|
40
|
+
assert_plaintext "****\nTest\n****", "<h1>Test</h1>"
|
41
|
+
assert_plaintext "****\nTest\n****", "\t<h1>\nTest</h1> "
|
42
|
+
assert_plaintext "***********\nTest line 1\nTest 2\n***********", "\t<h1>\nTest line 1<br>Test 2</h1> "
|
43
|
+
assert_plaintext "****\nTest\n****\n\n****\nTest\n****", "<h1>Test</h1> <h1>Test</h1>"
|
44
|
+
assert_plaintext "----\nTest\n----", "<h2>Test</h2>"
|
45
|
+
assert_plaintext "Test\n----", "<h3> <span class='a'>Test </span></h3>"
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_links
|
49
|
+
# basic
|
50
|
+
assert_plaintext 'Link ( http://example.com/ )', '<a href="http://example.com/">Link</a>'
|
51
|
+
|
52
|
+
# nested html
|
53
|
+
assert_plaintext 'Link ( http://example.com/ )', '<a href="http://example.com/"><span class="a">Link</span></a>'
|
54
|
+
|
55
|
+
# complex link
|
56
|
+
assert_plaintext 'Link ( http://example.com:80/~user?aaa=bb&c=d,e,f#foo )', '<a href="http://example.com:80/~user?aaa=bb&c=d,e,f#foo">Link</a>'
|
57
|
+
|
58
|
+
# attributes
|
59
|
+
assert_plaintext 'Link ( http://example.com/ )', '<a title=\'title\' href="http://example.com/">Link</a>'
|
60
|
+
|
61
|
+
# spacing
|
62
|
+
assert_plaintext 'Link ( http://example.com/ )', '<a href=" http://example.com/ "> Link </a>'
|
63
|
+
|
64
|
+
# merge links
|
65
|
+
assert_plaintext 'Link ( %%LINK%% )', '<a href="%%LINK%%">Link</a>'
|
66
|
+
assert_plaintext 'Link ( [LINK] )', '<a href="[LINK]">Link</a>'
|
67
|
+
assert_plaintext 'Link ( {LINK} )', '<a href="{LINK}">Link</a>'
|
68
|
+
end
|
69
|
+
|
70
|
+
def assert_plaintext(out, raw, msg = nil)
|
71
|
+
assert_equal out, convert_to_text(raw), msg
|
72
|
+
end
|
73
|
+
end
|