mikedamage-premailer-plus 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +42 -20
- data/README.textile +4 -2
- data/VERSION.yml +1 -1
- data/lib/premailer.rb +6 -1
- metadata +1 -1
data/LICENSE
CHANGED
@@ -1,20 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
Premailer License
|
2
|
+
|
3
|
+
Copyright (c) 2007 Alex Dunae
|
4
|
+
|
5
|
+
Premailer is copyrighted free software by Alex Dunae (http://dunae.ca/).
|
6
|
+
You can redistribute it and/or modify it under the conditions below:
|
7
|
+
|
8
|
+
1. You may make and give away verbatim copies of the source form of the
|
9
|
+
software without restriction, provided that you duplicate all of the
|
10
|
+
original copyright notices and associated disclaimers.
|
11
|
+
|
12
|
+
2. You may modify your copy of the software in any way, provided that
|
13
|
+
you do at least ONE of the following:
|
14
|
+
|
15
|
+
a) place your modifications in the Public Domain or otherwise
|
16
|
+
make them Freely Available, such as by posting said
|
17
|
+
modifications to the internet or an equivalent medium, or by
|
18
|
+
allowing the author to include your modifications in the software.
|
19
|
+
|
20
|
+
b) use the modified software only within your corporation or
|
21
|
+
organization.
|
22
|
+
|
23
|
+
c) rename any non-standard executables so the names do not conflict
|
24
|
+
with standard executables, which must also be provided.
|
25
|
+
|
26
|
+
d) make other distribution arrangements with the author.
|
27
|
+
|
28
|
+
3. You may modify and include the part of the software into any other
|
29
|
+
software (possibly commercial) as long as clear acknowledgement and
|
30
|
+
a link back to the original software (http://code.dunae.ca/premailer.web/)
|
31
|
+
is provided.
|
32
|
+
|
33
|
+
5. The scripts and library files supplied as input to or produced as
|
34
|
+
output from the software do not automatically fall under the
|
35
|
+
copyright of the software, but belong to whomever generated them,
|
36
|
+
and may be sold commercially, and may be aggregated with this
|
37
|
+
software.
|
38
|
+
|
39
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
40
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
41
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
42
|
+
PURPOSE.
|
data/README.textile
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
h1. premailer-plus
|
2
2
|
|
3
|
-
|*
|
3
|
+
|*Misc. improvements by:*||Mike Green ("mike.is.green@gmail.com":mailto:mike.is.green@gmail.com)|
|
4
4
|
|*Original Premailer By:*||Alex Dunae ("http://www.dunae.ca":http://www.dunae.ca)|
|
5
5
|
|
6
|
+
Check out the Premailer web application at http://code.dunae.ca/premailer.web
|
7
|
+
|
6
8
|
h2. Background
|
7
9
|
|
8
10
|
Premailer Plus is my set of additions and corrections to Alex Dunae's excellent "Premailer":http://code.dunae.ca/premailer.web/ application. Premailer is "Preflight for HTML email", i.e. it takes your HTML code, and makes it compatible with most email clients. Email clients aren't like web browsers; their support for CSS is spotty and erratic, and they don't always render your code the way you'd expect. Premailer takes your CSS and moves it inline to each matched HTML element, and it displays warnings if you use code that's not well supported by email clients. "Campaign Monitor":http://www.campaignmonitor.com sponsors and uses Premailer to get your code ready for mass emails. It's a one of a kind, indispensible service, but I've always had a few gripes about the Premailer Rubygem, so I finally decided to fork the code and apply my fixes and improvements.
|
@@ -38,4 +40,4 @@ h2. Dependencies
|
|
38
40
|
|
39
41
|
h2. Copyright
|
40
42
|
|
41
|
-
|
43
|
+
Since I only improved Premailer's handling of local files and gave it the ability to shorten URL's, the copyright to this code is still held by Alex Dunae. I am only modifying and redistributing his code in compliance with the terms of Premailer's license.
|
data/VERSION.yml
CHANGED
data/lib/premailer.rb
CHANGED
@@ -12,6 +12,7 @@ require 'yaml'
|
|
12
12
|
require 'open-uri'
|
13
13
|
require 'hpricot'
|
14
14
|
require 'css_parser'
|
15
|
+
require 'tempfile'
|
15
16
|
|
16
17
|
require 'html_to_plain_text'
|
17
18
|
|
@@ -180,7 +181,11 @@ protected
|
|
180
181
|
if @is_local_file
|
181
182
|
Hpricot(File.open(uri, "r") {|f| f.read })
|
182
183
|
else
|
183
|
-
|
184
|
+
@temp_file = Tempfile.new("premailer_plus")
|
185
|
+
@temp_file.write(open(uri).read)
|
186
|
+
@temp_file.close
|
187
|
+
@is_local_file = true
|
188
|
+
Hpricot(@temp_file.open.read)
|
184
189
|
end
|
185
190
|
end
|
186
191
|
|