premailer 1.8.1 → 1.8.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.
- checksums.yaml +4 -4
- data/lib/premailer/premailer.rb +11 -6
- data/lib/premailer/version.rb +1 -1
- data/test/test_misc.rb +1 -1
- data/test/test_premailer.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f49a37803e79dad5aba97c68db82c73b167f172
|
4
|
+
data.tar.gz: 528bb4f127c4571d5aca3bf396386600050bb6e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a60e8883cee7b95c700b14390eeab652ca9bd379d2307a15729156f29a3a78323015485fc7310de7f01794c6114a3709fd5d6bde01ca4f8ed6964f89f625375c
|
7
|
+
data.tar.gz: 441ee16ad13d367e9aa3acc2dde17cf894ef19b745ba0a0330d2a56525208210b93197bea03b36a6c0823fed3aa42de47bcfc77519bf43003c1b0cb95b56ae64
|
data/lib/premailer/premailer.rb
CHANGED
@@ -286,12 +286,17 @@ protected
|
|
286
286
|
# but the local one is different (e.g. newer) than the live file, premailer will now choose the local file
|
287
287
|
|
288
288
|
if tag.attributes['href'].to_s.include? @base_url.to_s and @html_file.kind_of?(String)
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
289
|
+
if @options[:with_html_string]
|
290
|
+
link_uri = tag.attributes['href'].to_s.sub(@base_url.to_s, '').sub(/\A\/*/, '')
|
291
|
+
else
|
292
|
+
link_uri = File.join(File.dirname(@html_file), tag.attributes['href'].to_s.sub!(@base_url.to_s, ''))
|
293
|
+
# if the file does not exist locally, try to grab the remote reference
|
294
|
+
unless File.exists?(link_uri)
|
295
|
+
link_uri = Premailer.resolve_link(tag.attributes['href'].to_s, @html_file)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
else
|
299
|
+
link_uri = tag.attributes['href'].to_s
|
295
300
|
end
|
296
301
|
|
297
302
|
if Premailer.local_data?(link_uri)
|
data/lib/premailer/version.rb
CHANGED
data/test/test_misc.rb
CHANGED
@@ -172,7 +172,7 @@ END_HTML
|
|
172
172
|
|
173
173
|
assert_equal "color: blue", premailer.processed_doc.at('a').attributes['style'].to_s,
|
174
174
|
"#{adapter}: Failed to inline the default style"
|
175
|
-
assert_match /@media \(min-width:500px\) \{.*?a {.*?color: red;.*?\}.*?\}/m, style_tag_contents,
|
175
|
+
assert_match /@media \(min-width:500px\) \{.*?a \{.*?color: red;.*?\}.*?\}/m, style_tag_contents,
|
176
176
|
"#{adapter}: Failed to add media query with no type to style"
|
177
177
|
assert_match /@media screen and \(orientation: portrait\) \{.*?a \{.*?color: green;.*?\}.*?\}/m, style_tag_contents,
|
178
178
|
"#{adapter}: Failed to add media query with type to style"
|
data/test/test_premailer.rb
CHANGED
@@ -258,6 +258,15 @@ END_HTML
|
|
258
258
|
assert_equal expected_html, pm.to_inline_css
|
259
259
|
end
|
260
260
|
|
261
|
+
# output_encoding option should return HTML Entities when set to US-ASCII
|
262
|
+
def test_output_encoding
|
263
|
+
html_special_characters = "©"
|
264
|
+
html_entities_characters = "©"
|
265
|
+
expected_html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<html><body><p>" + html_entities_characters + "</p></body></html>\n"
|
266
|
+
pm = Premailer.new(html_special_characters, :output_encoding => "US-ASCII", :with_html_string => true, :adapter => :nokogiri, :input_encoding => "UTF-8");
|
267
|
+
assert_equal expected_html, pm.to_inline_css
|
268
|
+
end
|
269
|
+
|
261
270
|
def test_meta_encoding_downcase
|
262
271
|
meta_encoding = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
|
263
272
|
expected_html = Regexp.new(Regexp.escape('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'), Regexp::IGNORECASE)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: premailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dunae
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: css_parser
|