inline-style 0.1.1 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +7 -3
- data/README.rdoc +12 -9
- data/Rakefile +1 -1
- data/example.rb +2 -3
- data/lib/inline-style.rb +43 -18
- data/lib/inline-style/rack/middleware.rb +15 -8
- data/spec/as_middleware_spec.rb +15 -15
- data/spec/css_inlining_spec.rb +60 -18
- data/spec/fixtures/all.css +3 -0
- data/spec/fixtures/boletin.html +256 -0
- data/spec/fixtures/box-model.html +37 -0
- data/spec/fixtures/inline.html +107 -0
- data/spec/fixtures/none.css +3 -0
- data/spec/fixtures/print.css +3 -0
- data/spec/fixtures/selectors.html +27 -0
- data/spec/fixtures/style.css +2 -3
- data/spec/spec_helper.rb +1 -1
- metadata +16 -10
- data/inline-style.gemspec +0 -46
- data/rack-inline-styles.gemspec +0 -37
- data/spec/fixtures/with-style-tag.html +0 -55
data/Manifest.txt
CHANGED
@@ -3,12 +3,16 @@ Manifest.txt
|
|
3
3
|
README.rdoc
|
4
4
|
Rakefile
|
5
5
|
example.rb
|
6
|
-
inline-style.gemspec
|
7
6
|
lib/inline-style.rb
|
8
7
|
lib/inline-style/rack/middleware.rb
|
9
|
-
rack-inline-styles.gemspec
|
10
8
|
spec/as_middleware_spec.rb
|
11
9
|
spec/css_inlining_spec.rb
|
10
|
+
spec/fixtures/all.css
|
11
|
+
spec/fixtures/boletin.html
|
12
|
+
spec/fixtures/box-model.html
|
13
|
+
spec/fixtures/inline.html
|
14
|
+
spec/fixtures/none.css
|
15
|
+
spec/fixtures/print.css
|
16
|
+
spec/fixtures/selectors.html
|
12
17
|
spec/fixtures/style.css
|
13
|
-
spec/fixtures/with-style-tag.html
|
14
18
|
spec/spec_helper.rb
|
data/README.rdoc
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
= inline-style
|
2
2
|
|
3
|
-
|
3
|
+
http://github.com/maca/inline-style
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
Will take all css in a page (either from linked stylesheet or from style tag) and will embed it in the style attribute for
|
8
|
+
each refered element taking selector specificity and declarator order.
|
9
|
+
|
10
|
+
Useful for html email: some clients (gmail, et all) won't render non inline styles.
|
9
11
|
|
10
12
|
* Includes a Rack middleware for using with Rails, Sinatra, etc...
|
11
13
|
* It takes into account selector specificity.
|
@@ -14,7 +16,7 @@ correctly render stylesheets in some clients such as gmail.
|
|
14
16
|
require 'inline-style'
|
15
17
|
|
16
18
|
html = File.read("#{ dir }/index.html")
|
17
|
-
puts InlineStyle.process(html, "#{ dir }/styles")
|
19
|
+
puts InlineStyle.process(html, :stylesheets_paths => "#{ dir }/styles")
|
18
20
|
|
19
21
|
index.html contains:
|
20
22
|
|
@@ -63,7 +65,7 @@ index.html contains:
|
|
63
65
|
</li>
|
64
66
|
</ul>
|
65
67
|
|
66
|
-
Will
|
68
|
+
Will become:
|
67
69
|
|
68
70
|
<ul id="number" class="listing inlined" style='font-family: "Lucida Grande", Lucida, Verdana, sans-serif;margin: 4.0px 3.0px 2.0px 1.0px;padding: 0.0;background-color: yellow;'>
|
69
71
|
<li class="list-element odd" style='font-family: "Lucida Grande", Lucida, Verdana, sans-serif;margin: 4.0px 3.0px 2.0px 1.0px;padding: 0.0;background-color: black;'>
|
@@ -80,7 +82,7 @@ Will output:
|
|
80
82
|
</li>
|
81
83
|
</ul>
|
82
84
|
|
83
|
-
|
85
|
+
== RACK MIDDLEWARE:
|
84
86
|
|
85
87
|
# Process all routes:
|
86
88
|
use InlineStyle::Rack::Middleware
|
@@ -92,8 +94,9 @@ As rack middleware:
|
|
92
94
|
use InlineStyle::Rack::Middleware, :paths => [%r(/mails/.*), "/somepath"]
|
93
95
|
|
94
96
|
== ISSUES:
|
95
|
-
|
96
|
-
*
|
97
|
+
|
98
|
+
* It supports pseudo classes according to W3C specification for style in style attribute: http://www.w3.org/TR/css-style-attr, although browsers
|
99
|
+
doesn't seems to.
|
97
100
|
* It strips any numeric character (Rails may add) at the end of the stylesheet file name, anyway stylesheets should end with .css extension
|
98
101
|
|
99
102
|
== REQUIREMENTS:
|
@@ -102,7 +105,7 @@ tenderlove's nokogiri and csspool
|
|
102
105
|
|
103
106
|
== INSTALL:
|
104
107
|
|
105
|
-
sudo gem install inline-style --source http://gemcutter.org
|
108
|
+
sudo gem install inline-style --source http://gemcutter.org
|
106
109
|
|
107
110
|
== LICENSE:
|
108
111
|
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ $hoe = Hoe.new('inline-style', InlineStyle::VERSION) do |p|
|
|
8
8
|
p.rubyforge_name = p.name
|
9
9
|
p.extra_deps = [
|
10
10
|
['nokogiri','>= 1.3.3'],
|
11
|
-
['csspool', '>= 2.0.
|
11
|
+
['maca-fork-csspool', '>= 2.0.2']
|
12
12
|
]
|
13
13
|
p.extra_dev_deps = [
|
14
14
|
['newgem', ">= #{::Newgem::VERSION}"]
|
data/example.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require "#{ dir = File.dirname(__FILE__) }/lib/inline-style"
|
3
|
-
require 'benchmark'
|
4
3
|
|
5
|
-
html = File.read("#{ dir
|
6
|
-
puts InlineStyle.process(html
|
4
|
+
html = File.read("#{ fixtures = dir + '/spec/fixtures' }/boletin.html")
|
5
|
+
puts InlineStyle.process(html)
|
data/lib/inline-style.rb
CHANGED
@@ -1,22 +1,36 @@
|
|
1
1
|
require 'nokogiri'
|
2
2
|
require 'open-uri'
|
3
|
-
require 'csspool'
|
3
|
+
require '/Users/sistemasinteractivos/Gems/Web/csspool/lib/csspool'
|
4
4
|
|
5
5
|
require "#{ File.dirname( __FILE__ ) }/inline-style/rack/middleware"
|
6
6
|
|
7
7
|
module InlineStyle
|
8
|
-
VERSION = '0.
|
9
|
-
|
10
|
-
|
8
|
+
VERSION = '0.4'
|
9
|
+
|
10
|
+
# Options:
|
11
|
+
# +:stylesheets_path+
|
12
|
+
# Stylesheets root path, can also be a URL
|
13
|
+
#
|
14
|
+
# +pseudo+
|
15
|
+
# If set to true will inline style for pseudo classes according to the W3C specification:
|
16
|
+
# http://www.w3.org/TR/css-style-attr.
|
17
|
+
# Defaults to false and should probably be left like that because at least Safari and Firefox don't seem to
|
18
|
+
# comply with the specification for pseudo class style in the style attribute.
|
19
|
+
def self.process html, opts = {}
|
20
|
+
stylesheets_path = opts[:stylesheets_path] || ''
|
21
|
+
pseudo = opts[:pseudo] || false
|
22
|
+
|
11
23
|
nokogiri_doc_given = Nokogiri::HTML::Document === html
|
12
|
-
|
13
24
|
html = nokogiri_doc_given ? html : Nokogiri.HTML(html)
|
14
|
-
css = extract_css html,
|
25
|
+
css = extract_css html, stylesheets_path
|
15
26
|
nodes = {}
|
16
27
|
|
17
28
|
css.rule_sets.each do |rule_set|
|
18
29
|
rule_set.selectors.each do |selector|
|
19
|
-
|
30
|
+
css_selector = selector.to_s
|
31
|
+
css_selector = "#{ 'body ' unless /^body/ === css_selector }#{ css_selector.gsub /:.*/, '' }"
|
32
|
+
|
33
|
+
html.css(css_selector).each do |node|
|
20
34
|
nodes[node] ||= []
|
21
35
|
nodes[node].push selector
|
22
36
|
|
@@ -26,31 +40,42 @@ module InlineStyle
|
|
26
40
|
path << "##{ node['id'] }" if node['id']
|
27
41
|
path << ".#{ node['class'].scan(/\S+/).join('.') }" if node['class']
|
28
42
|
|
29
|
-
CSSPool.CSS("#{ path }{#{ node['style'] }}").rule_sets.each{ |rule| nodes[node].push *rule.selectors}
|
43
|
+
CSSPool.CSS("#{ path }{#{ node['style'] }}").rule_sets.each{ |rule| nodes[node].push *rule.selectors }
|
30
44
|
end
|
31
45
|
end
|
32
46
|
end
|
33
47
|
|
34
48
|
nodes.each_pair do |node, style|
|
35
|
-
style = style.sort_by{ |sel| "#{ sel.specificity }
|
36
|
-
style.
|
37
|
-
|
49
|
+
style = style.sort_by{ |sel| "#{ sel.specificity }%03d" % style.index(sel) }
|
50
|
+
sets = style.partition{ |sel| not /:\w+/ === sel.to_s }
|
51
|
+
|
52
|
+
sets.pop if not pseudo or sets.last.empty?
|
53
|
+
|
54
|
+
node['style'] = sets.collect do |selectors|
|
55
|
+
index = sets.index selectors
|
56
|
+
|
57
|
+
set = selectors.map do |selector|
|
58
|
+
declarations = selector.declarations.map{ |d| d.to_css.squeeze(' ') }.join
|
59
|
+
index == 0 ? declarations : "\n#{ selector.to_s.gsub /\w(?=:)/, '' } {#{ declarations }}"
|
60
|
+
end
|
61
|
+
|
62
|
+
index == 0 && sets.size > 1 ? "{#{ set }}" : set.join
|
63
|
+
end.join.strip
|
38
64
|
end
|
39
65
|
|
40
66
|
nokogiri_doc_given ? html : html.to_s
|
41
67
|
end
|
42
68
|
|
43
|
-
|
44
|
-
|
69
|
+
# Returns CSSPool::Document
|
70
|
+
def self.extract_css html, stylesheets_path = ''
|
45
71
|
CSSPool.CSS html.css('style, link').collect { |e|
|
46
|
-
next unless e['media'].nil?
|
72
|
+
next unless e['media'].nil? or ['screen', 'all'].include? e['media']
|
47
73
|
next(e.remove and e.content) if e.name == 'style'
|
48
74
|
next unless e['rel'] == 'stylesheet'
|
49
75
|
e.remove
|
50
|
-
|
51
|
-
|
76
|
+
|
77
|
+
uri = %r{^https?://} === e['href'] ? e['href'] : File.join(stylesheets_path, e['href'].sub(/\?\d+$/,''))
|
78
|
+
open(uri).read rescue nil
|
52
79
|
}.join("\n")
|
53
80
|
end
|
54
|
-
|
55
|
-
|
56
81
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module InlineStyle
|
2
2
|
module Rack
|
3
|
-
|
4
3
|
class Middleware
|
4
|
+
#
|
5
5
|
# Options:
|
6
6
|
# +document_root+
|
7
7
|
# File system path for app's public directory where the stylesheets are to be found, defaults to
|
@@ -10,11 +10,19 @@ module InlineStyle
|
|
10
10
|
# +paths+
|
11
11
|
# Limit processing to the passed absolute paths
|
12
12
|
# Can be an array of strings or regular expressions, a single string or regular expression
|
13
|
-
# If not passed will process output for every path
|
13
|
+
# If not passed will process output for every path.
|
14
|
+
# Regexps and strings must comence with '/'
|
15
|
+
#
|
16
|
+
# +pseudo+
|
17
|
+
# If set to true will inline style for pseudo classes according to the W3C specification:
|
18
|
+
# http://www.w3.org/TR/css-style-attr.
|
19
|
+
# Defaults to false and should probably be left like that because at least Safari and Firefox don't seem to
|
20
|
+
# comply with the specification for pseudo class style in the style attribute.
|
21
|
+
#
|
14
22
|
def initialize app, opts = {}
|
15
|
-
@app
|
16
|
-
@document_root
|
17
|
-
@paths
|
23
|
+
@app = app
|
24
|
+
@opts = {:document_root => env['DOCUMENT_ROOT']}.merge(opts)
|
25
|
+
@paths = /^(?:#{ [*opts[:paths]].join('|') })/
|
18
26
|
end
|
19
27
|
|
20
28
|
def call env
|
@@ -24,12 +32,11 @@ module InlineStyle
|
|
24
32
|
status, headers, content = response
|
25
33
|
response = ::Rack::Response.new '', status, headers
|
26
34
|
body = content.respond_to?(:body) ? content.body : content
|
27
|
-
|
28
|
-
response.write InlineStyle.process(body, @
|
35
|
+
|
36
|
+
response.write InlineStyle.process(body, @opts)
|
29
37
|
response.finish
|
30
38
|
end
|
31
39
|
end
|
32
|
-
|
33
40
|
end
|
34
41
|
end
|
35
42
|
|
data/spec/as_middleware_spec.rb
CHANGED
@@ -12,46 +12,46 @@ describe InlineStyle::Rack::Middleware do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
before do
|
15
|
-
@html = File.read("#{ FIXTURES }/
|
15
|
+
@html = File.read("#{ FIXTURES }/boletin.html")
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should inline css" do
|
19
|
-
get_response('/', @html, :stylesheets_path => FIXTURES).should have_inline_style_for('
|
19
|
+
get_response('/', @html, :stylesheets_path => FIXTURES).should have_inline_style_for('#A')
|
20
20
|
end
|
21
21
|
|
22
22
|
describe 'Path inclusion' do
|
23
23
|
|
24
24
|
it "should inline style for string path" do
|
25
25
|
paths = "/some/path"
|
26
|
-
get_response('/some/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should have_inline_style_for('
|
26
|
+
get_response('/some/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should have_inline_style_for('#A')
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should not inline style for string path" do
|
30
30
|
paths = "/some/path"
|
31
|
-
get_response('/some/other/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should_not have_inline_style_for('
|
31
|
+
get_response('/some/other/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should_not have_inline_style_for('#A')
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should inline style for regexp path" do
|
35
|
-
paths = %r{some/.*}
|
36
|
-
get_response('/some/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should have_inline_style_for('
|
37
|
-
get_response('/some/other/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should have_inline_style_for('
|
35
|
+
paths = %r{/some/.*}
|
36
|
+
get_response('/some/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should have_inline_style_for('#A')
|
37
|
+
get_response('/some/other/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should have_inline_style_for('#A')
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should not inline style for regexp path" do
|
41
|
-
paths = %r{some/.*}
|
42
|
-
get_response('/other/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should_not have_inline_style_for('
|
41
|
+
paths = %r{/some/.*}
|
42
|
+
get_response('/other/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should_not have_inline_style_for('#A')
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should inline style for array regexp path" do
|
46
|
-
paths = [%r{some/path}, %r{/some/other/path}]
|
47
|
-
get_response('/some/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should have_inline_style_for('
|
48
|
-
get_response('/some/other/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should have_inline_style_for('
|
46
|
+
paths = [%r{/some/path}, %r{/some/other/path}]
|
47
|
+
get_response('/some/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should have_inline_style_for('#A')
|
48
|
+
get_response('/some/other/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should have_inline_style_for('#A')
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should not inline style for array regexp path" do
|
52
|
-
paths = [%r{some/path}, %r{/some/other/path}]
|
53
|
-
get_response('/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should_not have_inline_style_for('
|
54
|
-
get_response('/other/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should_not have_inline_style_for('
|
52
|
+
paths = [%r{/some/path}, %r{/some/other/path}]
|
53
|
+
get_response('/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should_not have_inline_style_for('#A')
|
54
|
+
get_response('/other/path', @html, :stylesheets_path => FIXTURES, :paths => paths).should_not have_inline_style_for('#A')
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
data/spec/css_inlining_spec.rb
CHANGED
@@ -1,30 +1,72 @@
|
|
1
|
-
require "#{
|
1
|
+
require "#{ File.dirname __FILE__ }/spec_helper"
|
2
2
|
|
3
3
|
describe InlineStyle do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
before do
|
5
|
+
@processed = InlineStyle.process Nokogiri.HTML(File.read("#{ FIXTURES }/boletin.html")),
|
6
|
+
:pseudo => false,
|
7
|
+
:stylesheets_path => FIXTURES
|
7
8
|
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
it 'should separate terms by coma'
|
12
|
-
it 'should order selectors by specificity'
|
13
|
-
it 'should order selectors by specificity and defininition order'
|
10
|
+
it "should extract from linked stylesheet" do
|
11
|
+
@processed.css('#izq').first['style'].should =~ /margin: 30.0px;/
|
14
12
|
end
|
15
13
|
|
14
|
+
it "should extract styles from linked stylesheet with no media specified" do
|
15
|
+
@processed.css('#izq').first['style'].should =~ /color: red;/
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should extract styles from linked stylesheet with media 'all'" do
|
19
|
+
@processed.css('#izq').first['style'].should =~ /padding: 10.0px;/
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should ignore styles from linked stylesheet with media other than screen" do
|
23
|
+
@processed.css('#izq').first['style'].should_not =~ /display: none;/
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should not process pseudo classes" do
|
27
|
+
@processed.to_s.should_not =~ /:hover/
|
28
|
+
@processed.to_s.should_not =~ /\{/
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should should process pseudo classes" do
|
32
|
+
processed = InlineStyle.process Nokogiri.HTML(File.read("#{ FIXTURES }/boletin.html")), :pseudo => true
|
33
|
+
processed.css('a').first['style'].should =~ /:hover/
|
34
|
+
processed.css('a').first['style'].should =~ /\{/
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should apply to #A #B' do
|
38
|
+
@processed.css('#logos #der').first['style'].should =~ /float: right;/
|
39
|
+
end
|
40
|
+
|
41
|
+
# it 'should order selectors by specificity'
|
42
|
+
# it 'should order selectors by specificity and defininition order'
|
43
|
+
# it 'should overwrite rule with less specificity'
|
44
|
+
# it 'should overwrite rule previously defined'
|
45
|
+
# it 'should not overwrite rules defined inline'
|
46
|
+
|
47
|
+
describe 'Box model' do
|
48
|
+
before do
|
49
|
+
@processed = InlineStyle.process( Nokogiri.HTML(File.read("#{ FIXTURES }/box-model.html")) )
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should inline style for selector ul" do
|
53
|
+
@processed.css('ul').first['style'].should == "background: yellow; margin: 12.0px 12.0px 12.0px 12.0px; padding: 3.0px 3.0px 3.0px 3.0px;"
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should inline style for selector li" do
|
57
|
+
@processed.css('li').each do |li|
|
58
|
+
li['style'].should =~ /^color: white; background: blue; margin: 12.0px 12.0px 12.0px 12.0px; padding: 12.0px 0.0px 12.0px 12.0px; list-style: none/
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should inline style for selector li.withborder" do
|
63
|
+
@processed.css('li.withborder').first['style'].
|
64
|
+
should == "color: white; background: blue; margin: 12.0px 12.0px 12.0px 12.0px; padding: 12.0px 0.0px 12.0px 12.0px; list-style: none; border-style: dashed; border-width: medium; border-color: lime;"
|
65
|
+
end
|
66
|
+
end
|
16
67
|
end
|
17
68
|
|
18
69
|
|
19
70
|
|
20
71
|
|
21
72
|
|
22
|
-
# It should order selectors by specificity
|
23
|
-
# it should order selectors by specificity and defininition order
|
24
|
-
# It should apply inline style by tag
|
25
|
-
# It should apply inline style by universal selector
|
26
|
-
# It should apply inline style for class
|
27
|
-
# It should apply inline style for id
|
28
|
-
# It should overwrite rule with less specificity
|
29
|
-
# It should overwrite rule previously defined
|
30
|
-
# It should not overwrite rules defined inline
|
@@ -0,0 +1,256 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-type" />
|
6
|
+
<title> Boletín CENART - November
|
7
|
+
</title>
|
8
|
+
|
9
|
+
<link href="/style.css?1248460539" rel="stylesheet" media="screen" type="text/css" />
|
10
|
+
|
11
|
+
<link href="/print.css?1248460539" rel="stylesheet" media="print" type="text/css" />
|
12
|
+
<link href="/all.css?1248460539" rel="stylesheet" media="all" type="text/css" />
|
13
|
+
<link href="/none.css?1248460539" rel="stylesheet" type="text/css" />
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<style media="screen" type="text/css">
|
21
|
+
* {
|
22
|
+
margin: 0;
|
23
|
+
padding: 0;
|
24
|
+
}
|
25
|
+
|
26
|
+
body {
|
27
|
+
font: 13px "Lucida Grande", Lucida, Verdana, sans-serif;
|
28
|
+
width: 680px;
|
29
|
+
color: #373737;
|
30
|
+
margin-left: auto;
|
31
|
+
margin-right: auto;
|
32
|
+
}
|
33
|
+
|
34
|
+
p {
|
35
|
+
margin: 10px 0;
|
36
|
+
}
|
37
|
+
|
38
|
+
.clearer {
|
39
|
+
clear: both;
|
40
|
+
}
|
41
|
+
|
42
|
+
#banner {
|
43
|
+
margin: 15px;
|
44
|
+
text-align: right;
|
45
|
+
color: #639b22;
|
46
|
+
}
|
47
|
+
|
48
|
+
#banner span {
|
49
|
+
font-size: 20px;
|
50
|
+
}
|
51
|
+
|
52
|
+
#aviso {
|
53
|
+
padding: 25px 0;
|
54
|
+
text-align: center;
|
55
|
+
}
|
56
|
+
|
57
|
+
dl.categoria dt {
|
58
|
+
font-size: 20px;
|
59
|
+
padding: 10px;
|
60
|
+
background-color: #416517;
|
61
|
+
border-bottom: 1px dashed #a6a6a6;
|
62
|
+
color: #a0bf57;
|
63
|
+
}
|
64
|
+
|
65
|
+
dl.evento, div#direccion, div#contacto {
|
66
|
+
padding: 30px 25px 20px 35px;
|
67
|
+
}
|
68
|
+
|
69
|
+
dl.evento {
|
70
|
+
border-bottom: 1px dashed #a6a6a6;
|
71
|
+
}
|
72
|
+
|
73
|
+
dl.evento.non {
|
74
|
+
background-color: #d9e3cf;
|
75
|
+
}
|
76
|
+
|
77
|
+
dl.evento.par {
|
78
|
+
background-color: #cfdfe3;
|
79
|
+
}
|
80
|
+
|
81
|
+
dl.evento dt {
|
82
|
+
padding: 0;
|
83
|
+
font-size: 20px;
|
84
|
+
background: none;
|
85
|
+
font-weight: bold;
|
86
|
+
border: none;
|
87
|
+
}
|
88
|
+
|
89
|
+
a, b {
|
90
|
+
color: #185d6b;
|
91
|
+
}
|
92
|
+
|
93
|
+
a:hover {
|
94
|
+
background-color: #8ae0ea;
|
95
|
+
color: #126b5d;
|
96
|
+
}
|
97
|
+
|
98
|
+
dl.evento dd {
|
99
|
+
text-align: justify;
|
100
|
+
margin: 10px 0;
|
101
|
+
}
|
102
|
+
|
103
|
+
dd.poster {
|
104
|
+
float: right;
|
105
|
+
}
|
106
|
+
|
107
|
+
dd.poster img {
|
108
|
+
border: 1px solid #909090;
|
109
|
+
margin: 0 0 25px 25px;
|
110
|
+
}
|
111
|
+
|
112
|
+
div#footer b {
|
113
|
+
color: #5f792d;
|
114
|
+
}
|
115
|
+
|
116
|
+
div#contacto a {
|
117
|
+
font-weight: bold;
|
118
|
+
font-size: 1.2em;
|
119
|
+
}
|
120
|
+
|
121
|
+
#logos {
|
122
|
+
width: 100%;
|
123
|
+
margin-top: 40px;
|
124
|
+
background-image: url('/images/boletines/Noviembre/logos_fondo.jpg');
|
125
|
+
}
|
126
|
+
|
127
|
+
#izq {
|
128
|
+
float: left;
|
129
|
+
}
|
130
|
+
|
131
|
+
#logos #der {
|
132
|
+
float: right;
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
</style>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<div id="header">
|
142
|
+
<div id="aviso">Si usted no puede visualizar correctamente este boletín haga <a href="http://localhost:3000/boletines/noviembre-2009">click aquí</a></div>
|
143
|
+
<div id="banner"><span id="cenart">CENART</span> Noviembre 2009</div>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
<dl class="categoria" id="A">
|
151
|
+
<dt>A</dt>
|
152
|
+
<dd>
|
153
|
+
|
154
|
+
|
155
|
+
<dl class="evento non">
|
156
|
+
<dt><a href="">1</a></dt>
|
157
|
+
|
158
|
+
<dd class="descripcion"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
159
|
+
</dd>
|
160
|
+
<dd class="fechas"><b>Fechas: </b>Fecha</dd>
|
161
|
+
<dd class="locacion"><b>Lugar: </b>Lugar</dd>
|
162
|
+
<dd class="precio"><b>Público: </b>Público</dd>
|
163
|
+
<dd class="precio"><b>Precio: </b>Precio</dd>
|
164
|
+
</dl>
|
165
|
+
|
166
|
+
|
167
|
+
</dd>
|
168
|
+
</dl>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<dl class="categoria" id="B">
|
179
|
+
<dt>B</dt>
|
180
|
+
<dd>
|
181
|
+
|
182
|
+
|
183
|
+
<dl class="evento par">
|
184
|
+
<dt><a href="">1</a></dt>
|
185
|
+
|
186
|
+
<dd class="descripcion"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
187
|
+
</dd>
|
188
|
+
<dd class="fechas"><b>Fechas: </b>Fecha</dd>
|
189
|
+
<dd class="locacion"><b>Lugar: </b>Lugar</dd>
|
190
|
+
<dd class="precio"><b>Público: </b>Público</dd>
|
191
|
+
<dd class="precio"><b>Precio: </b>Precio</dd>
|
192
|
+
</dl>
|
193
|
+
|
194
|
+
|
195
|
+
</dd>
|
196
|
+
</dl>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<dl class="categoria" id="C">
|
203
|
+
<dt>C</dt>
|
204
|
+
<dd>
|
205
|
+
|
206
|
+
|
207
|
+
<dl class="evento non">
|
208
|
+
<dt><a href="">1</a></dt>
|
209
|
+
|
210
|
+
<dd class="descripcion"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
211
|
+
</dd>
|
212
|
+
<dd class="fechas"><b>Fechas: </b>Fecha</dd>
|
213
|
+
<dd class="locacion"><b>Lugar: </b>Lugar</dd>
|
214
|
+
<dd class="precio"><b>Público: </b>Público</dd>
|
215
|
+
<dd class="precio"><b>Precio: </b>Precio</dd>
|
216
|
+
</dl>
|
217
|
+
|
218
|
+
|
219
|
+
</dd>
|
220
|
+
</dl>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
<div id="footer">
|
233
|
+
<div id="direccion">
|
234
|
+
<b>lorem</b><br/ >
|
235
|
+
ipsum<br />
|
236
|
+
dolor<br />
|
237
|
+
sit<br />
|
238
|
+
</div>
|
239
|
+
|
240
|
+
<div id="contacto">
|
241
|
+
contacto <br />
|
242
|
+
<a href="mailto:mail@host.org">mail@host.org</a>
|
243
|
+
</div>
|
244
|
+
<div id="logos">
|
245
|
+
<img src="A" id="izq" alt="A" />
|
246
|
+
<img src="B" id="der" alt="B" />
|
247
|
+
<div class="clearer">
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
</div></body>
|
254
|
+
|
255
|
+
|
256
|
+
</html>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<!DOCTYPE html PUBliC "-//W3C//DTD html 4.01//EN">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Examples of margins, padding, and borders</title>
|
5
|
+
<style type="text/css">
|
6
|
+
|
7
|
+
ul {
|
8
|
+
background: yellow;
|
9
|
+
margin: 12px 12px 12px 12px;
|
10
|
+
padding: 3px 3px 3px 3px;
|
11
|
+
/* No borders set */
|
12
|
+
}
|
13
|
+
li.withborder {
|
14
|
+
border-style: dashed;
|
15
|
+
border-width: medium; /* sets border width on all sides */
|
16
|
+
border-color: lime;
|
17
|
+
}
|
18
|
+
li {
|
19
|
+
color: white; /* text color is white */
|
20
|
+
background: blue; /* Content, padding will be blue */
|
21
|
+
margin: 12px 12px 12px 12px;
|
22
|
+
padding: 12px 0px 12px 12px; /* Note 0px padding right */
|
23
|
+
list-style: none /* no glyphs before a list item */
|
24
|
+
}
|
25
|
+
|
26
|
+
#A #B {
|
27
|
+
color: red;
|
28
|
+
}
|
29
|
+
</style>
|
30
|
+
</head>
|
31
|
+
<body>
|
32
|
+
<ul>
|
33
|
+
<li>First element of list</li>
|
34
|
+
<li class="withborder">Second element of list is a bit longer to illustrate wrapping.</li>
|
35
|
+
</ul>
|
36
|
+
</body>
|
37
|
+
</html>
|
@@ -0,0 +1,107 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title> Boletín CENART - November
|
6
|
+
</title>
|
7
|
+
<link href="/print.css?1248460539" rel="stylesheet" media="print" type="text/css">
|
8
|
+
</head>
|
9
|
+
<body style='font: 13.0px "Lucida Grande", Lucida, Verdana, sans-serif; width: 680.0px; color: #373737; margin-left: auto; margin-right: auto;'>
|
10
|
+
<div id="header" style="margin: 0.0; padding: 0.0;">
|
11
|
+
<div id="aviso" style="margin: 0.0; padding: 0.0; padding: 25.0px 0.0; text-align: center;">Si usted no puede visualizar correctamente este boletín haga <a href="http://localhost:3000/boletines/noviembre-2009" style="margin: 0.0; padding: 0.0; color: #185d6b;">click aquí</a>
|
12
|
+
</div>
|
13
|
+
<div id="banner" style="margin: 0.0; padding: 0.0; margin: 15.0px; text-align: right; color: #639b22;">
|
14
|
+
<span id="cenart" style="margin: 0.0; padding: 0.0; font-size: 20.0px;">CENART</span> Noviembre 2009</div>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<dl class="categoria" id="A" style="margin: 0.0; padding: 0.0;">
|
22
|
+
<dt style="margin: 0.0; padding: 0.0; font-size: 20.0px; padding: 10.0px; background-color: #416517; border-bottom: 1.0px dashed #a6a6a6; color: #a0bf57;">A</dt>
|
23
|
+
<dd style="margin: 0.0; padding: 0.0;">
|
24
|
+
|
25
|
+
|
26
|
+
<dl class="evento non" style="margin: 0.0; padding: 0.0; padding: 30.0px 25.0px 20.0px 35.0px; border-bottom: 1.0px dashed #a6a6a6; background-color: #d9e3cf;">
|
27
|
+
<dt style="margin: 0.0; padding: 0.0; font-size: 20.0px; padding: 10.0px; background-color: #416517; border-bottom: 1.0px dashed #a6a6a6; color: #a0bf57; padding: 0.0; font-size: 20.0px; background: none; font-weight: bold; border: none;"><a href="" style="margin: 0.0; padding: 0.0; color: #185d6b;">1</a></dt>
|
28
|
+
|
29
|
+
<dd class="descripcion" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
30
|
+
<p style="margin: 0.0; padding: 0.0; margin: 10.0px 0.0;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
31
|
+
</dd>
|
32
|
+
<dd class="fechas" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
33
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Fechas: </b>Fecha</dd>
|
34
|
+
<dd class="locacion" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
35
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Lugar: </b>Lugar</dd>
|
36
|
+
<dd class="precio" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
37
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Público: </b>Público</dd>
|
38
|
+
<dd class="precio" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
39
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Precio: </b>Precio</dd>
|
40
|
+
</dl>
|
41
|
+
</dd>
|
42
|
+
</dl>
|
43
|
+
<dl class="categoria" id="B" style="margin: 0.0; padding: 0.0;">
|
44
|
+
<dt style="margin: 0.0; padding: 0.0; font-size: 20.0px; padding: 10.0px; background-color: #416517; border-bottom: 1.0px dashed #a6a6a6; color: #a0bf57;">B</dt>
|
45
|
+
<dd style="margin: 0.0; padding: 0.0;">
|
46
|
+
|
47
|
+
|
48
|
+
<dl class="evento par" style="margin: 0.0; padding: 0.0; padding: 30.0px 25.0px 20.0px 35.0px; border-bottom: 1.0px dashed #a6a6a6; background-color: #cfdfe3;">
|
49
|
+
<dt style="margin: 0.0; padding: 0.0; font-size: 20.0px; padding: 10.0px; background-color: #416517; border-bottom: 1.0px dashed #a6a6a6; color: #a0bf57; padding: 0.0; font-size: 20.0px; background: none; font-weight: bold; border: none;"><a href="" style="margin: 0.0; padding: 0.0; color: #185d6b;">1</a></dt>
|
50
|
+
|
51
|
+
<dd class="descripcion" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
52
|
+
<p style="margin: 0.0; padding: 0.0; margin: 10.0px 0.0;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
53
|
+
</dd>
|
54
|
+
<dd class="fechas" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
55
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Fechas: </b>Fecha</dd>
|
56
|
+
<dd class="locacion" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
57
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Lugar: </b>Lugar</dd>
|
58
|
+
<dd class="precio" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
59
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Público: </b>Público</dd>
|
60
|
+
<dd class="precio" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
61
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Precio: </b>Precio</dd>
|
62
|
+
</dl>
|
63
|
+
</dd>
|
64
|
+
</dl>
|
65
|
+
<dl class="categoria" id="C" style="margin: 0.0; padding: 0.0;">
|
66
|
+
<dt style="margin: 0.0; padding: 0.0; font-size: 20.0px; padding: 10.0px; background-color: #416517; border-bottom: 1.0px dashed #a6a6a6; color: #a0bf57;">C</dt>
|
67
|
+
<dd style="margin: 0.0; padding: 0.0;">
|
68
|
+
|
69
|
+
|
70
|
+
<dl class="evento non" style="margin: 0.0; padding: 0.0; padding: 30.0px 25.0px 20.0px 35.0px; border-bottom: 1.0px dashed #a6a6a6; background-color: #d9e3cf;">
|
71
|
+
<dt style="margin: 0.0; padding: 0.0; font-size: 20.0px; padding: 10.0px; background-color: #416517; border-bottom: 1.0px dashed #a6a6a6; color: #a0bf57; padding: 0.0; font-size: 20.0px; background: none; font-weight: bold; border: none;"><a href="" style="margin: 0.0; padding: 0.0; color: #185d6b;">1</a></dt>
|
72
|
+
|
73
|
+
<dd class="descripcion" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
74
|
+
<p style="margin: 0.0; padding: 0.0; margin: 10.0px 0.0;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
75
|
+
</dd>
|
76
|
+
<dd class="fechas" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
77
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Fechas: </b>Fecha</dd>
|
78
|
+
<dd class="locacion" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
79
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Lugar: </b>Lugar</dd>
|
80
|
+
<dd class="precio" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
81
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Público: </b>Público</dd>
|
82
|
+
<dd class="precio" style="margin: 0.0; padding: 0.0; text-align: justify; margin: 10.0px 0.0;">
|
83
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b;">Precio: </b>Precio</dd>
|
84
|
+
</dl>
|
85
|
+
</dd>
|
86
|
+
</dl>
|
87
|
+
<div id="footer" style="margin: 0.0; padding: 0.0;">
|
88
|
+
<div id="direccion" style="margin: 0.0; padding: 0.0; padding: 30.0px 25.0px 20.0px 35.0px;">
|
89
|
+
<b style="margin: 0.0; padding: 0.0; color: #185d6b; color: #5f792d;">lorem</b><br style="margin: 0.0; padding: 0.0;">
|
90
|
+
ipsum<br style="margin: 0.0; padding: 0.0;">
|
91
|
+
dolor<br style="margin: 0.0; padding: 0.0;">
|
92
|
+
sit<br style="margin: 0.0; padding: 0.0;">
|
93
|
+
</div>
|
94
|
+
|
95
|
+
<div id="contacto" style="margin: 0.0; padding: 0.0; padding: 30.0px 25.0px 20.0px 35.0px;">
|
96
|
+
contacto <br style="margin: 0.0; padding: 0.0;"><a href="mailto:mail@host.org" style="margin: 0.0; padding: 0.0; color: #185d6b; font-weight: bold; font-size: 1.2em;">mail@host.org</a>
|
97
|
+
</div>
|
98
|
+
<div id="logos" style="margin: 0.0; padding: 0.0; width: 100.0%; margin-top: 40.0px; background-image: url(/images/boletines/Noviembre/logos_fondo.jpg);">
|
99
|
+
<img src="A" id="izq" alt="A" style="margin: 0.0; padding: 0.0; float: left;"><img src="B" id="der" alt="B" style="margin: 0.0; padding: 0.0; float: right;"><div class="clearer" style="margin: 0.0; padding: 0.0; clear: both;">
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
</div>
|
106
|
+
</body>
|
107
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<!DOCTYPE html PUBliC "-//W3C//DTD html 4.01//EN">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Examples of margins, padding, and borders</title>
|
5
|
+
<style type="text/css">
|
6
|
+
#A #B {
|
7
|
+
color: red;
|
8
|
+
}
|
9
|
+
.cA .cB {
|
10
|
+
color: blue;
|
11
|
+
}
|
12
|
+
|
13
|
+
</style>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<div id="A">
|
17
|
+
A
|
18
|
+
<div id="B">B</div>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="cA">
|
22
|
+
cA
|
23
|
+
<div class="cB">cB</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
</body>
|
27
|
+
</html>
|
data/spec/fixtures/style.css
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -15,7 +15,7 @@ module HaveInlineStyleMatcher
|
|
15
15
|
|
16
16
|
def matches? html
|
17
17
|
@html = html
|
18
|
-
@html.css(@selector).inject(true){ |bool, e| bool and !e['style'].nil? }
|
18
|
+
!@html.css(@selector).empty? and @html.css(@selector).inject(true){ |bool, e| bool and !e['style'].nil? }
|
19
19
|
end
|
20
20
|
|
21
21
|
def failure_message
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inline-style
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: "0.4"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Macario Ortega
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-29 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -23,14 +23,14 @@ dependencies:
|
|
23
23
|
version: 1.3.3
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name: csspool
|
26
|
+
name: maca-fork-csspool
|
27
27
|
type: :runtime
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.0.
|
33
|
+
version: 2.0.2
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: newgem
|
@@ -53,8 +53,10 @@ dependencies:
|
|
53
53
|
version: 1.8.0
|
54
54
|
version:
|
55
55
|
description: |-
|
56
|
-
|
57
|
-
|
56
|
+
Will take all css in a page (either from linked stylesheet or from style tag) and will embed it in the style attribute for
|
57
|
+
each refered element taking selector specificity and declarator order.
|
58
|
+
|
59
|
+
Useful for html email: some clients (gmail, et all) won't render non inline styles.
|
58
60
|
|
59
61
|
* Includes a Rack middleware for using with Rails, Sinatra, etc...
|
60
62
|
* It takes into account selector specificity.
|
@@ -74,14 +76,18 @@ files:
|
|
74
76
|
- README.rdoc
|
75
77
|
- Rakefile
|
76
78
|
- example.rb
|
77
|
-
- inline-style.gemspec
|
78
79
|
- lib/inline-style.rb
|
79
80
|
- lib/inline-style/rack/middleware.rb
|
80
|
-
- rack-inline-styles.gemspec
|
81
81
|
- spec/as_middleware_spec.rb
|
82
82
|
- spec/css_inlining_spec.rb
|
83
|
+
- spec/fixtures/all.css
|
84
|
+
- spec/fixtures/boletin.html
|
85
|
+
- spec/fixtures/box-model.html
|
86
|
+
- spec/fixtures/inline.html
|
87
|
+
- spec/fixtures/none.css
|
88
|
+
- spec/fixtures/print.css
|
89
|
+
- spec/fixtures/selectors.html
|
83
90
|
- spec/fixtures/style.css
|
84
|
-
- spec/fixtures/with-style-tag.html
|
85
91
|
- spec/spec_helper.rb
|
86
92
|
has_rdoc: true
|
87
93
|
homepage: http://github.com/maca/inline-style
|
@@ -111,6 +117,6 @@ rubyforge_project: inline-style
|
|
111
117
|
rubygems_version: 1.3.5
|
112
118
|
signing_key:
|
113
119
|
specification_version: 3
|
114
|
-
summary:
|
120
|
+
summary: Will take all css in a page (either from linked stylesheet or from style tag) and will embed it in the style attribute for each refered element taking selector specificity and declarator order
|
115
121
|
test_files: []
|
116
122
|
|
data/inline-style.gemspec
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{inline-style}
|
5
|
-
s.version = "0.1"
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Macario Ortega"]
|
9
|
-
s.date = %q{2009-10-22}
|
10
|
-
s.description = %q{Simple utility for "inlining" all CSS in the style attribute for the html tags. Useful for html emails that won't
|
11
|
-
correctly render stylesheets in some clients such as gmail.
|
12
|
-
|
13
|
-
* Includes a Rack middleware for using with Rails, Sinatra, etc...
|
14
|
-
* It takes into account selector specificity.}
|
15
|
-
s.email = ["macarui@gmail.com"]
|
16
|
-
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
|
17
|
-
s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "example.rb", "inline-style.gemspec", "lib/inline-style.rb", "lib/inline-style/rack/middleware.rb", "rack-inline-styles.gemspec", "spec/as_middleware_spec.rb", "spec/css_inlining_spec.rb", "spec/fixtures/style.css", "spec/fixtures/with-style-tag.html", "spec/spec_helper.rb"]
|
18
|
-
s.homepage = %q{http://github.com/maca/inline-style}
|
19
|
-
s.rdoc_options = ["--main", "README.rdoc"]
|
20
|
-
s.require_paths = ["lib"]
|
21
|
-
s.rubyforge_project = %q{inline-style}
|
22
|
-
s.rubygems_version = %q{1.3.5}
|
23
|
-
s.summary = %q{Simple utility for "inlining" all CSS in the style attribute for the html tags}
|
24
|
-
|
25
|
-
if s.respond_to? :specification_version then
|
26
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
27
|
-
s.specification_version = 3
|
28
|
-
|
29
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
30
|
-
s.add_runtime_dependency(%q<nokogiri>, [">= 1.3.3"])
|
31
|
-
s.add_runtime_dependency(%q<csspool>, [">= 2.0.0"])
|
32
|
-
s.add_development_dependency(%q<newgem>, [">= 1.4.1"])
|
33
|
-
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
34
|
-
else
|
35
|
-
s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
|
36
|
-
s.add_dependency(%q<csspool>, [">= 2.0.0"])
|
37
|
-
s.add_dependency(%q<newgem>, [">= 1.4.1"])
|
38
|
-
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
39
|
-
end
|
40
|
-
else
|
41
|
-
s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
|
42
|
-
s.add_dependency(%q<csspool>, [">= 2.0.0"])
|
43
|
-
s.add_dependency(%q<newgem>, [">= 1.4.1"])
|
44
|
-
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
45
|
-
end
|
46
|
-
end
|
data/rack-inline-styles.gemspec
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{rack-inline-styles}
|
5
|
-
s.version = "0.0.1"
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Macario Ortega"]
|
9
|
-
s.date = %q{2009-10-16}
|
10
|
-
s.description = %q{FIX (describe your package)}
|
11
|
-
s.email = ["macarui@gmail.com"]
|
12
|
-
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
|
13
|
-
s.files = [".git/HEAD", ".git/config", ".git/description", ".git/hooks/applypatch-msg", ".git/hooks/commit-msg", ".git/hooks/post-commit", ".git/hooks/post-receive", ".git/hooks/post-update", ".git/hooks/pre-applypatch", ".git/hooks/pre-commit", ".git/hooks/pre-rebase", ".git/hooks/update", ".git/index", ".git/info/exclude", ".git/objects/14/fa7459b8ceed4fef2dae431412c51591335354", ".git/objects/2c/0095bcd01468cbafdbb01befcd08cd60ccfb78", ".git/objects/37/04bf0d18ced6f7c6a85467ca3ae017e87d9bf4", ".git/objects/55/8a5df09d6f6b75f07504dd86ead7a0078c9031", ".git/objects/a6/cfe2d2693a7d73be08898b26a1f44886878c21", ".git/objects/e4/f29ca4d0099d827535a935fed78a2aa70fb3e7", ".git/objects/f0/4fbfb5595b8187bf753bdedebb89ee835c28ef", "History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "lib/rack/inline-styles.rb", "rack-inline-styles.gemspec", "spec/spec_helper.rb"]
|
14
|
-
s.has_rdoc = true
|
15
|
-
s.homepage = %q{http://github.com/#{github_username}/#{project_name}}
|
16
|
-
s.rdoc_options = ["--main", "README.rdoc"]
|
17
|
-
s.require_paths = ["lib"]
|
18
|
-
s.rubyforge_project = %q{rack-inline-styles}
|
19
|
-
s.rubygems_version = %q{1.3.1}
|
20
|
-
s.summary = %q{FIX (describe your package)}
|
21
|
-
|
22
|
-
if s.respond_to? :specification_version then
|
23
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
-
s.specification_version = 2
|
25
|
-
|
26
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
-
s.add_development_dependency(%q<newgem>, [">= 1.4.1"])
|
28
|
-
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
29
|
-
else
|
30
|
-
s.add_dependency(%q<newgem>, [">= 1.4.1"])
|
31
|
-
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
32
|
-
end
|
33
|
-
else
|
34
|
-
s.add_dependency(%q<newgem>, [">= 1.4.1"])
|
35
|
-
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
36
|
-
end
|
37
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/html4/loose.dtd">
|
3
|
-
|
4
|
-
<html lang="en">
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
7
|
-
|
8
|
-
<style type="text/css" media="screen">
|
9
|
-
* {
|
10
|
-
font-family: "Lucida Grande", Lucida, Verdana, sans-serif;
|
11
|
-
margin: 4px 3px 2px 1px;
|
12
|
-
padding: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
#list {
|
16
|
-
margin: 10;
|
17
|
-
}
|
18
|
-
|
19
|
-
#list li {
|
20
|
-
font-family: Arial;
|
21
|
-
}
|
22
|
-
|
23
|
-
.element {
|
24
|
-
padding: 10;
|
25
|
-
}
|
26
|
-
|
27
|
-
.odd {
|
28
|
-
background-color: black;
|
29
|
-
}
|
30
|
-
|
31
|
-
.pair {
|
32
|
-
background-color: red;
|
33
|
-
}
|
34
|
-
|
35
|
-
</style>
|
36
|
-
<link rel="stylesheet" href="style.css?1212121" type="text/css" media="screen" title="no title" charset="utf-8">
|
37
|
-
|
38
|
-
</head>
|
39
|
-
<body>
|
40
|
-
<ul id='number' class='listing inlined' style='background-color: yellow'>
|
41
|
-
<li class='list-element odd'>
|
42
|
-
<span>1</span>
|
43
|
-
</li>
|
44
|
-
<li class='list-element pair'>
|
45
|
-
<span>2</span>
|
46
|
-
</li>
|
47
|
-
<li class='list-element odd'>
|
48
|
-
<span>3</span>
|
49
|
-
</li>
|
50
|
-
<li class='list-element pair'>
|
51
|
-
<span>4</span>
|
52
|
-
</li>
|
53
|
-
</ul>
|
54
|
-
</body>
|
55
|
-
</html>
|