docomo_css 0.0.1 → 0.0.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/README.rdoc CHANGED
@@ -13,20 +13,9 @@ Instead, every element must use its own style attribute, for example
13
13
 
14
14
  docomo_css works around this by inlining all CSS automatically for you.
15
15
 
16
- Furthermore, DoCoMo phones have a number of limitations about how you can style
17
- elements. For instance, the following will not be rendered properly.
18
-
19
- <h1 style="color:red">Foo</h1>
20
-
21
- However, this can be worked around by doing the following
22
-
23
- <h1><span style="color:red">Foo</span></h1>
24
-
25
- This library will automatically do this transformation for you if you apply css styles to unsupported elements like h1.
26
-
27
16
  == Install
28
17
 
29
- sudo gem install milk1000cc-docomo_css --source=http://gems.github.com
18
+ sudo gem install docomo_css
30
19
 
31
20
  == Usage
32
21
 
@@ -42,7 +31,6 @@ This library will automatically do this transformation for you if you apply css
42
31
  <%= stylesheet_link_tag 'foo', :media => 'handheld, tty' %>
43
32
  </head>
44
33
  <body>
45
- <h1>Header</h1>
46
34
  <div class="title">bar</div>
47
35
  </body>
48
36
  </html>
@@ -51,10 +39,6 @@ This library will automatically do this transformation for you if you apply css
51
39
  .title {
52
40
  color: red;
53
41
  }
54
-
55
- h1 {
56
- color:blue:
57
- }
58
42
 
59
43
  # result
60
44
  <html>
@@ -62,7 +46,6 @@ This library will automatically do this transformation for you if you apply css
62
46
  <%= stylesheet_link_tag 'foo', :media => 'handheld, tty' %>
63
47
  </head>
64
48
  <body>
65
- <h1><span style="color:blue">Header</span></h1>
66
49
  <div class="title" style="color:red">bar</div>
67
50
  </body>
68
51
  </html>
@@ -80,4 +63,4 @@ Copyright (c) 2008 milk1000cc, released under the MIT license
80
63
 
81
64
  milk1000cc <mailto:info@milk1000.cc>
82
65
 
83
- Gem, refactorings, and additions by Paul McMahon <mailto:paul@mobalean.com>
66
+ Gem and refactorings by Paul McMahon <mailto:paul@mobalean.com>
data/Rakefile CHANGED
@@ -31,7 +31,7 @@ begin
31
31
  s.homepage = "http://www.milk1000.cc/"
32
32
  s.authors = ["milk1000cc", "Paul McMahon"]
33
33
  s.add_dependency 'hpricot'
34
- s.add_dependency 'milk1000cc-tiny_css'
34
+ s.add_dependency 'tiny_css'
35
35
  end
36
36
  rescue LoadError
37
37
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/docomo_css.gemspec CHANGED
@@ -1,12 +1,15 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{docomo_css}
5
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["milk1000cc", "Paul McMahon"]
9
- s.date = %q{2009-06-11}
12
+ s.date = %q{2010-09-15}
10
13
  s.description = %q{Inlines CSS so that you can use external CSS with docomo handsets.}
11
14
  s.email = %q{info@milk1000.cc}
12
15
  s.extra_rdoc_files = [
@@ -20,17 +23,17 @@ Gem::Specification.new do |s|
20
23
  "VERSION",
21
24
  "docomo_css.gemspec",
22
25
  "init.rb",
23
- "install.rb",
24
26
  "lib/docomo_css.rb",
25
27
  "rails/init.rb",
28
+ "test/actual.css",
29
+ "test/actual.html",
26
30
  "test/docomo_css_test.rb",
27
- "uninstall.rb"
31
+ "test/expected.html"
28
32
  ]
29
- s.has_rdoc = true
30
33
  s.homepage = %q{http://www.milk1000.cc/}
31
34
  s.rdoc_options = ["--charset=UTF-8"]
32
35
  s.require_paths = ["lib"]
33
- s.rubygems_version = %q{1.3.1}
36
+ s.rubygems_version = %q{1.3.7}
34
37
  s.summary = %q{CSS inliner}
35
38
  s.test_files = [
36
39
  "test/docomo_css_test.rb"
@@ -38,9 +41,9 @@ Gem::Specification.new do |s|
38
41
 
39
42
  if s.respond_to? :specification_version then
40
43
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
41
- s.specification_version = 2
44
+ s.specification_version = 3
42
45
 
43
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
47
  s.add_runtime_dependency(%q<hpricot>, [">= 0"])
45
48
  s.add_runtime_dependency(%q<tiny_css>, [">= 0"])
46
49
  else
@@ -52,3 +55,4 @@ Gem::Specification.new do |s|
52
55
  s.add_dependency(%q<tiny_css>, [">= 0"])
53
56
  end
54
57
  end
58
+
data/init.rb CHANGED
@@ -1,2 +1 @@
1
- require 'docomo_css/rails'
2
- ActionController::Base.send :include, DocomoCss::Rails
1
+ require File.join File.dirname(__FILE__), 'rails', 'init'
data/lib/docomo_css.rb CHANGED
@@ -1,130 +1,116 @@
1
- require 'hpricot'
1
+ require 'nokogiri'
2
2
  require 'tiny_css'
3
3
 
4
4
  module DocomoCss
5
5
 
6
- def self.handlers
7
- unless defined?(@handlers)
8
- element_handler = UnsupportedElementHandler.new(
9
- (1..6).map {|i| "h#{i}"} + %w{p},
10
- %w{font-size color})
11
- @handlers = Hash.new {|h,k| h[k] = DefaultHandler.new(k, element_handler)}
12
- ["a:link", "a:focus", "a:visited"].each do |k|
13
- @handlers[k] = PseudoSelectorHandler.new(k)
14
- end
6
+ def self.included(base)
7
+ base.extend ClassMethods
8
+ end
9
+
10
+ module ClassMethods
11
+ def docomo_filter
12
+ after_filter DocomoCssFilter.new
15
13
  end
16
- @handlers
17
14
  end
18
15
 
19
- def self.inline_css(content, css_dir)
20
- content.gsub!(/&#(\d+);/, 'HTMLCSSINLINERESCAPE\1::::::::')
16
+ class DocomoCssFilter
17
+ def after(controller)
18
+ return unless controller.response.content_type =~ /application\/xhtml\+xml/
19
+ return unless controller.request.user_agent =~ /docomo/i
20
+ return if docomo_2_0_browser?(controller)
21
+ body = escape_numeric_character_reference controller.response.body
22
+ body = embed_css remove_xml_declare(body)
23
+ controller.response.body = unescape_numeric_character_reference body
24
+ end
21
25
 
22
- doc = Hpricot(content)
26
+ def embed_css(body)
27
+ doc = Nokogiri::HTML(body)
23
28
 
24
- linknodes = doc/'//link[@rel="stylesheet"]'
25
- linknodes.each do |linknode|
26
- href = linknode['href']
27
- next unless href && allowed_media_type?(linknode['media'])
28
- if linknode['docomo_css'] == "ignore"
29
- linknode.remove_attribute('docomo_css')
30
- next
29
+ stylesheet_link_node(doc).each do |linknode|
30
+ href = linknode['href'] or next
31
+
32
+ next unless FileTest.exist? css_path(href)
33
+ css = TinyCss.new.read(css_path(href))
34
+ embed_pseudo_style(doc, extract_pseudo_style(css))
35
+ embed_style(doc, css)
31
36
  end
37
+ xml_declare(doc) + doc.to_xhtml(:indent => 0)
38
+ end
39
+
40
+ def xml_declare(doc)
41
+ <<-XML
42
+ <?xml version="1.0" encoding="#{doc.encoding}"?>
43
+ XML
44
+ end
32
45
 
33
- cssfile = File.join(css_dir, href)
34
- cssfile.gsub!(/\?.+/, '')
35
- css = TinyCss.new.read(cssfile)
46
+ def remove_xml_declare(body)
47
+ body.gsub(%r'<\?xml[^\?]*?\?>', '')
48
+ end
36
49
 
37
- style_style = TinyCss.new
50
+ def embed_style(doc, css)
38
51
  css.style.each do |selector, style|
39
- handlers[selector].replace(doc, style_style, style)
40
- end
41
- unless style_style.style.keys.empty?
42
- style = %(<style type="text/css">#{ style_style.write_string }</style>)
43
- (doc/('head')).append style
52
+ stringified_style = stringify_style(style)
53
+ doc.css(selector).each do |element|
54
+ element['style'] = merge_style element['style'], stringified_style
55
+ end
44
56
  end
45
57
  end
46
- doc.search('//link[@docomo_css="remove_after_inline"]').remove
47
58
 
48
- content = doc.to_html
49
-
50
- content.gsub!(/HTMLCSSINLINERESCAPE(\d+)::::::::/, '&#\1;')
51
- content
52
- end
59
+ def stringify_style(style)
60
+ style.map { |k, v| "#{ k }:#{ v }" }.join ';'
61
+ end
53
62
 
54
- def self.allowed_media_type?(s)
55
- s.nil? || s =~ /handheld|all|tty/
56
- end
63
+ def merge_style(style, other_style)
64
+ return other_style if style == nil
65
+ style += ";" unless style =~ /;\Z/
66
+ style + other_style
67
+ end
57
68
 
58
- class Handler
59
- def initialize(selector)
60
- @selector = selector
69
+ def escape_numeric_character_reference(text)
70
+ text.gsub /&#(\d+);/, 'HTMLCSSINLINERESCAPE\1::::::::'
61
71
  end
62
- end
63
72
 
64
- class PseudoSelectorHandler < Handler
65
- def replace(doc, style_style, style)
66
- style_style.style[@selector] = style
73
+ def unescape_numeric_character_reference(text)
74
+ text.gsub /HTMLCSSINLINERESCAPE(\d+)::::::::/, '&#\1;'
67
75
  end
68
- end
69
76
 
70
- class DefaultHandler < Handler
71
- def initialize(selector, element_handler)
72
- super(selector)
73
- @element_handler = element_handler
77
+ def stylesheet_link_node(document)
78
+ document.xpath '//link[@rel="stylesheet"]'
74
79
  end
75
80
 
76
- def replace(doc, style_style, style)
77
- (doc/(@selector)).each do |element|
78
- @element_handler.add_style(element, style)
79
- end
81
+ def css_path(href)
82
+ File.join(Rails.root, 'public', href.gsub(/\?\d+/, ''))
80
83
  end
81
- end
82
84
 
83
- class UnsupportedElementHandler
84
- def initialize(unsupported_elements, unsupported_styles)
85
- @unsupported_elements = unsupported_elements
86
- @unsupported_styles = unsupported_styles
85
+ def extract_pseudo_style(css)
86
+ pseudo_style = TinyCss.new
87
+ pseudo_selectors(css).each do |v|
88
+ pseudo_style.style[v] = css.style[v]
89
+ css.style.delete(v)
90
+ end
91
+ pseudo_style
87
92
  end
88
93
 
89
- def add_style(element, style)
90
- if @unsupported_elements.include?(element.name)
91
- unsupported = TinyCss::OrderedHash.new
92
- supported = TinyCss::OrderedHash.new
93
- style.each do |k,v|
94
- s = @unsupported_styles.include?(k) ? unsupported : supported
95
- s[k] = v
96
- end
94
+ def embed_pseudo_style(doc, pseudo_style)
95
+ return if pseudo_style.style.keys.empty?
97
96
 
98
- #TODO: unit test
99
- _add_style(element, supported) unless supported.keys.empty?
100
-
101
- unless unsupported.keys.empty?
102
- # BUG: assumes source contains no span wrapped in selector
103
- wrapped_children = element.search("span")
104
- if wrapped_children.empty?
105
- element.search("/").wrap("<span></span>")
106
- wrapped_children = element.search("span")
107
- end
108
- wrapped_children.each do |c|
109
- add_style(c, unsupported)
110
- end
111
- end
112
- else
113
- _add_style(element, style)
114
- end
97
+ raise unless doc.at('/html/head')
98
+ doc.at('/html/head').add_child <<-STYLE
99
+ <style type="text/css">
100
+ #{pseudo_style.write_string}
101
+ </style>
102
+ STYLE
103
+ doc
115
104
  end
116
105
 
117
- def _add_style(element, style)
118
- style_attr = element[:style]
119
- style_attr = (!style_attr) ? stringify_style(style) :
120
- [style_attr, stringify_style(style)].join(';')
121
- element[:style] = style_attr
106
+ def pseudo_selectors(css)
107
+ css.style.keys.grep(/a:(link|focus|visited)/)
122
108
  end
123
109
 
124
110
  private
125
111
 
126
- def stringify_style(style)
127
- style.map { |k, v| "#{ k }:#{ v }" }.join ';'
112
+ def docomo_2_0_browser?(controller)
113
+ controller.request.user_agent =~ /DoCoMo\/2\.0 [^(]*\(c(\d+);/ && $1.to_i >= 500
128
114
  end
129
115
  end
130
116
  end
data/rails/init.rb CHANGED
@@ -1,2 +1,2 @@
1
- require 'docomo_css/rails'
2
- ActionController::Base.send :include, DocomoCss::Rails
1
+ require 'docomo_css'
2
+ ActionController::Base.send :include, DocomoCss
data/test/actual.css ADDED
@@ -0,0 +1,4 @@
1
+ a:link { color: red; }
2
+ a:focus { color: green; }
3
+ a:visited { color: blue; }
4
+ div.content { background-color: #999 }
data/test/actual.html ADDED
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="Shift_JIS"?>
2
+ <!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/2.3) 1.0//EN" "i-xhtml_4ja_10.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=Shift_JIS" />
6
+ <link rel="stylesheet" href="/actual.css" />
7
+ </head>
8
+ <body>
9
+ <div class="content">
10
+ <a href="/">TOP</a>
11
+ </div>
12
+ </body>
13
+ </html>
@@ -1,46 +1,194 @@
1
1
  require 'test/unit'
2
2
  require 'rubygems'
3
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
4
- require 'docomo_css'
3
+ require 'mocha'
4
+ require File.join File.dirname(__FILE__), '..', 'lib', 'docomo_css'
5
+
6
+ Rails = Mocha::Mockery.instance.unnamed_mock
7
+ Rails.stubs(:root => File.dirname(__FILE__))
5
8
 
6
9
  class DocomoCssTest < Test::Unit::TestCase
7
- def self.data_path
8
- File.join(File.dirname(__FILE__), "data")
9
- end
10
-
11
- Dir.glob(File.join(data_path, "html", "*")) do |f|
12
- s = File.basename(f,".html")
13
- define_method("test_#{s}") do
14
- e = expected(s)
15
- i = inline(s)
16
- e_lines = e.split("\n")
17
- i_lines = i.split("\n")
18
- e_lines.each_with_index do |s,j|
19
- assert_equal(s, i_lines[j])
20
- end
21
- assert_equal e, i, "#{s} did not match"
10
+ def setup
11
+ @filter = DocomoCss::DocomoCssFilter.new
12
+ end
13
+
14
+ def test_invalid_response_content_type
15
+ response = mock("invalid_response") do
16
+ expects(:content_type).returns('text/html').once
17
+ expects(:body).never
18
+ end
19
+ controller = stub("invalid_controller", :response => response)
20
+ @filter.after(controller)
21
+ end
22
+
23
+ def test_escape_numeric_character_reference
24
+ assert_equal "HTMLCSSINLINERESCAPE123456789::::::::", @filter.escape_numeric_character_reference("&#123456789;")
25
+ end
26
+
27
+ def test_unescape_numeric_character_reference
28
+ assert_equal "&#123456789;", @filter.unescape_numeric_character_reference("HTMLCSSINLINERESCAPE123456789::::::::")
29
+ end
30
+
31
+ def test_pseudo_selectors
32
+ css = TinyCss.new.read_string(<<-CSS)
33
+ a:visited { color: FF00FF; }
34
+ CSS
35
+ assert_equal ["a:visited"], @filter.pseudo_selectors(css)
36
+
37
+ css = TinyCss.new.read_string(<<-CSS)
38
+ .purple { color: FF00FF; }
39
+ CSS
40
+ assert_equal [], @filter.pseudo_selectors(css)
41
+ end
42
+
43
+ def test_stylesheet_link_node
44
+ doc = Nokogiri::HTML(<<-HTML)
45
+ <link href="a.css"/>
46
+ <link href="b.css" rel="stylesheet"/>
47
+ HTML
48
+
49
+ @filter.stylesheet_link_node(doc).each do |node|
50
+ assert_equal 'b.css', node['href']
51
+ end
52
+ end
53
+
54
+ def test_css_path
55
+ href = "/stylesheets/all.css?1274411517"
56
+ assert_equal "#{Rails.root}/public/stylesheets/all.css", @filter.css_path(href)
57
+ end
58
+
59
+ def test_extract_pseudo_style
60
+ css = TinyCss.new.read_string <<-CSS
61
+ a:link { color: red; }
62
+ a:focus { color: green; }
63
+ a:visited { color: blue; }
64
+ div.title { background-color: #999 }
65
+ CSS
66
+
67
+ pseudo_style = @filter.extract_pseudo_style css
68
+ assert_equal('red', pseudo_style.style['a:link']['color'])
69
+ assert_equal('green', pseudo_style.style['a:focus']['color'])
70
+ assert_equal('blue', pseudo_style.style['a:visited']['color'])
71
+ assert_equal('#999', css.style['div.title']['background-color'])
72
+ end
73
+
74
+ def test_embed_pseudo_style
75
+ css = TinyCss.new
76
+ assert_equal nil, @filter.embed_pseudo_style(nil, css)
77
+
78
+ css = TinyCss.new.read_string <<-CSS
79
+ a:link { color: red; }
80
+ a:focus { color: green; }
81
+ a:visited { color: blue; }
82
+ CSS
83
+
84
+ doc = Nokogiri::HTML <<-HTML
85
+ <html>
86
+ <head></head>
87
+ <body></body>
88
+ </html>
89
+ HTML
90
+ doc = @filter.embed_pseudo_style doc, css
91
+ assert_match %r'<style .*?/style>'m, doc.to_xhtml
92
+
93
+ doc = Nokogiri::HTML <<-HTML
94
+ <html>
95
+ <body></body>
96
+ </html>
97
+ HTML
98
+ assert_raise RuntimeError do
99
+ @filter.embed_pseudo_style doc, css
22
100
  end
23
101
  end
24
102
 
25
- def inline(file_name)
26
- DocomoCss.inline_css(html(file_name), data_path)
103
+ def test_embed_style
104
+ css = TinyCss.new.read_string <<-CSS
105
+ .title { color: red; }
106
+ CSS
107
+
108
+ doc = Nokogiri::HTML <<-HTML
109
+ <html>
110
+ <body>
111
+ <div class="title">bar</div>
112
+ </body>
113
+ </html>
114
+ HTML
115
+ @filter.embed_style doc, css
116
+ assert_match %r'style="color:red"', doc.to_xhtml
117
+
118
+ doc = Nokogiri::HTML <<-HTML
119
+ <html>
120
+ <body>
121
+ <div class="title" style="background-color:black">bar</div>
122
+ </body>
123
+ </html>
124
+ HTML
125
+ @filter.embed_style doc, css
126
+ assert_match %r'style="background-color:black;color:red"', doc.to_xhtml
127
+
128
+ doc = Nokogiri::HTML <<-HTML
129
+ <html>
130
+ <body>
131
+ <div class="title" style="background-color:silver;">bar</div>
132
+ </body>
133
+ </html>
134
+ HTML
135
+ @filter.embed_style doc, css
136
+ assert_match %r'style="background-color:silver;color:red"', doc.to_xhtml
137
+ end
138
+
139
+ def test_xml_declare
140
+ doc = stub("doc", :encoding => "Shift_JIS")
141
+ assert_equal <<-XML, @filter.xml_declare(doc)
142
+ <?xml version="1.0" encoding="Shift_JIS"?>
143
+ XML
144
+
145
+ doc = stub("doc", :encoding => "UTF-8")
146
+ assert_equal <<-XML, @filter.xml_declare(doc)
147
+ <?xml version="1.0" encoding="UTF-8"?>
148
+ XML
27
149
  end
28
150
 
29
- def html(file_name)
30
- read_html("html", file_name)
151
+ def test_remove_xml_declare
152
+ assert_equal '', @filter.remove_xml_declare('<?xml version="1.0"?>')
153
+ assert_equal '', @filter.remove_xml_declare('<?xml encoding="Shift_JIS"?>')
154
+ assert_equal '', @filter.remove_xml_declare('<?xml version="1.0" encoding="Shift_JIS" ?>')
155
+ assert_equal '', @filter.remove_xml_declare('<?xml?>')
31
156
  end
32
157
 
33
- def expected(file_name)
34
- read_html("expected_html", file_name)
158
+ def test_output_with_docomo_1_0_browser
159
+ request = stub('request', :user_agent => 'DoCoMo/2.0 D905i(c100;TB;W24H17)')
160
+ response = stub("response") do
161
+ expects(:content_type).returns('application/xhtml+xml')
162
+ expects(:body).returns(File.open(File.join(File.dirname(__FILE__), 'actual.html'), 'rb'){ |f| f.read })
163
+ expects(:body=).with(File.open(File.join(File.dirname(__FILE__), 'expected.html'), 'rb'){ |f| f.read })
164
+ end
165
+ controller = stub("controller", :response => response, :request => request)
166
+ @filter.stubs(:css_path).returns(File.join(File.dirname(__FILE__), 'actual.css'))
167
+
168
+ @filter.after(controller)
35
169
  end
36
170
 
37
- def read_html(dir, file_name)
38
- File.open(File.join(data_path, dir, "#{file_name}.html")) do |f|
39
- f.read
171
+ def test_output_with_docomo_1_0_browser_and_utf8_charset
172
+ request = stub('request', :user_agent => 'DoCoMo/2.0 D905i(c100;TB;W24H17)')
173
+ response = stub("response") do
174
+ expects(:content_type).returns('application/xhtml+xml; charset=utf-8')
175
+ expects(:body).returns(File.open(File.join(File.dirname(__FILE__), 'actual.html'), 'rb'){ |f| f.read })
176
+ expects(:body=).with(File.open(File.join(File.dirname(__FILE__), 'expected.html'), 'rb'){ |f| f.read })
40
177
  end
178
+ controller = stub("controller", :response => response, :request => request)
179
+ @filter.stubs(:css_path).returns(File.join(File.dirname(__FILE__), 'actual.css'))
180
+
181
+ @filter.after(controller)
41
182
  end
42
183
 
43
- def data_path
44
- self.class.data_path
184
+ def test_output_with_docomo_2_0_browser
185
+ request = stub('request', :user_agent => 'DoCoMo/2.0 N03B(c500;TB;W24H16)')
186
+ response = stub("response") do
187
+ expects(:content_type).returns('application/xhtml+xml')
188
+ expects(:body).never
189
+ end
190
+ controller = stub("controller", :response => response, :request => request)
191
+
192
+ @filter.after(controller)
45
193
  end
46
194
  end
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="Shift_JIS"?>
2
+ <!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/2.3) 1.0//EN" "i-xhtml_4ja_10.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=Shift_JIS" />
6
+ <link rel="stylesheet" href="/actual.css" />
7
+ <style type="text/css">
8
+ <![CDATA[
9
+ a:visited {
10
+ color: blue;
11
+ }
12
+ a:link {
13
+ color: red;
14
+ }
15
+ a:focus {
16
+ color: green;
17
+ }
18
+
19
+ ]]>
20
+ </style>
21
+ </head>
22
+ <body>
23
+ <div class="content" style="background-color:#999">
24
+ <a href="/">TOP</a>
25
+ </div>
26
+ </body>
27
+ </html>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docomo_css
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - milk1000cc
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2009-06-11 00:00:00 +09:00
19
+ date: 2010-09-15 00:00:00 +09:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -63,11 +63,12 @@ files:
63
63
  - VERSION
64
64
  - docomo_css.gemspec
65
65
  - init.rb
66
- - install.rb
67
66
  - lib/docomo_css.rb
68
67
  - rails/init.rb
68
+ - test/actual.css
69
+ - test/actual.html
69
70
  - test/docomo_css_test.rb
70
- - uninstall.rb
71
+ - test/expected.html
71
72
  has_rdoc: true
72
73
  homepage: http://www.milk1000.cc/
73
74
  licenses: []
@@ -100,7 +101,7 @@ requirements: []
100
101
  rubyforge_project:
101
102
  rubygems_version: 1.3.7
102
103
  signing_key:
103
- specification_version: 2
104
+ specification_version: 3
104
105
  summary: CSS inliner
105
106
  test_files:
106
107
  - test/docomo_css_test.rb
data/install.rb DELETED
@@ -1 +0,0 @@
1
- # Install hook code here
data/uninstall.rb DELETED
@@ -1 +0,0 @@
1
- # Uninstall hook code here