Skip to content

several updates and fix for Unicode BOM character #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 25 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,55 +1,52 @@
PATH
remote: .
specs:
inline-style (0.4.10)
inline-style (0.5.0)
css_parser
facets
maca-fork-csspool
nokogiri

GEM
remote: http://rubygems.org/
specs:
activesupport (3.0.4)
css_parser (1.1.5)
diff-lcs (1.1.2)
facets (2.9.1)
ffi (1.0.7)
rake (>= 0.8.7)
i18n (0.5.0)
addressable (2.2.6)
css_parser (1.2.6)
addressable
rdoc
diff-lcs (1.1.3)
ffi (1.0.11)
i18n (0.6.0)
json (1.6.5)
maca-fork-csspool (2.0.2)
ffi
mail (2.2.15)
activesupport (>= 2.3.6)
mail (2.4.1)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
nokogiri (1.4.4)
polyglot (0.3.1)
rack (1.2.1)
rake (0.8.7)
rspec (2.4.0)
rspec-core (~> 2.4.0)
rspec-expectations (~> 2.4.0)
rspec-mocks (~> 2.4.0)
rspec-core (2.4.0)
rspec-expectations (2.4.0)
mime-types (1.17.2)
nokogiri (1.5.0)
polyglot (0.3.3)
rack (1.4.1)
rdoc (3.12)
json (~> 1.4)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.4.0)
treetop (1.4.9)
rspec-mocks (2.8.0)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)

PLATFORMS
ruby

DEPENDENCIES
css_parser
facets
inline-style!
maca-fork-csspool
mail
nokogiri
rack
rspec
rspec-core
2 changes: 1 addition & 1 deletion inline-style.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rack'
s.add_development_dependency 'rspec-core'
s.add_development_dependency 'mail'
s.add_development_dependency 'maca-fork-csspool'

s.add_dependency 'nokogiri'
s.add_dependency 'css_parser'
s.add_dependency 'maca-fork-csspool'
end
5 changes: 1 addition & 4 deletions lib/inline-style.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
require 'nokogiri'
require 'open-uri'

$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

require "inline-style/rule"
require "inline-style/rack-middleware" # This two may be should be required by user if she needs it
require "inline-style/mail-interceptor"
Expand Down Expand Up @@ -87,7 +84,7 @@ def extract_css
node.content
else
uri = %r{^https?://} === node['href'] ? node['href'] : File.join(@stylesheets_path, node['href'].sub(/\?.+$/,''))
open(uri).read
open(uri).read.sub(/^\uFEFF/, '')
end
end.join("\n")
end
Expand Down
2 changes: 1 addition & 1 deletion lib/inline-style/mail-interceptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def delivering_email(part)
for part in part.parts
delivering_email part
end
elsif INLINE_MIME_TYPES.any? {|m| part.content_type.starts_with? m}
elsif INLINE_MIME_TYPES.any? {|m| part.content_type.start_with? m}
part.body = InlineStyle.process(part.body.to_s, @options)
part.content_transfer_encoding = nil
end
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/boletin.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<link href="/print.css?1248460539" rel="stylesheet" media="print" type="text/css" />
<link href="/all.css?1248460539" rel="stylesheet" media="all" type="text/css" />
<link href="/none.css?1248460539" rel="stylesheet" type="text/css" />
<link href="/none-notepad.css?1248460539" rel="stylesheet" type="text/css" />



Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/none-notepad.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#izq {
color: red;
}