color_parser 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Guardfile +2 -2
- data/README.md +4 -19
- data/color_parser.gemspec +2 -3
- data/lib/color_parser.rb +1 -45
- data/lib/color_parser/page.rb +14 -57
- data/lib/color_parser/stylesheet.rb +20 -82
- data/lib/color_parser/version.rb +1 -1
- data/spec/fixtures/css_color/stylesheets/color_styles.css +7 -7
- data/spec/fixtures/css_color/stylesheets/frequency.css +9 -9
- data/spec/page_spec.rb +27 -182
- data/spec/stylesheet_spec.rb +43 -153
- metadata +5 -95
- data/lib/color_parser/image.rb +0 -20
- data/lib/color_parser/request.rb +0 -21
- data/spec/color_parser_spec.rb +0 -88
- data/spec/fixtures/css/absolute.html +0 -15
- data/spec/fixtures/css/inline.html +0 -34
- data/spec/fixtures/css/inline_import.html +0 -16
- data/spec/fixtures/css/invalid.html +0 -15
- data/spec/fixtures/css/relative.html +0 -15
- data/spec/fixtures/css/relative_root.html +0 -15
- data/spec/fixtures/css/stylesheets/colors.css +0 -0
- data/spec/fixtures/css/stylesheets/fonts.css +0 -0
- data/spec/fixtures/css/stylesheets/print.css +0 -3
- data/spec/fixtures/css/stylesheets/screen.css +0 -16
- data/spec/fixtures/css_images/images/apple.png +0 -0
- data/spec/fixtures/css_images/images/cantaloupe.png +0 -0
- data/spec/fixtures/css_images/images/kiwi.jpg +0 -0
- data/spec/fixtures/css_images/images/mango.png +0 -0
- data/spec/fixtures/css_images/images/pineapple.png +0 -0
- data/spec/fixtures/css_images/paths.html +0 -14
- data/spec/fixtures/css_images/stylesheets/import_paths.css +0 -4
- data/spec/fixtures/css_images/stylesheets/paths.css +0 -17
- data/spec/fixtures/css_images/stylesheets/quotes.css +0 -14
- data/spec/fixtures/css_import/index.html +0 -15
- data/spec/fixtures/css_import/stylesheets/borders.css +0 -0
- data/spec/fixtures/css_import/stylesheets/colors.css +0 -0
- data/spec/fixtures/css_import/stylesheets/fonts.css +0 -3
- data/spec/fixtures/css_import/stylesheets/ie.css +0 -3
- data/spec/fixtures/css_import/stylesheets/images.css +0 -0
- data/spec/fixtures/css_import/stylesheets/master.css +0 -12
- data/spec/fixtures/css_import/stylesheets/print.css +0 -3
- data/spec/fixtures/css_import/stylesheets/screen.css +0 -12
- data/spec/fixtures/inline_images/absolute.html +0 -14
- data/spec/fixtures/inline_images/images/apple.png +0 -0
- data/spec/fixtures/inline_images/images/kiwi.jpg +0 -0
- data/spec/fixtures/inline_images/relative.html +0 -14
- data/spec/fixtures/inline_images/relative_root.html +0 -14
- data/spec/image_spec.rb +0 -33
- data/spec/request_spec.rb +0 -12
Binary file
|
Binary file
|
Binary file
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
|
4
|
-
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
7
|
-
<title>Color Parser</title>
|
8
|
-
|
9
|
-
<link rel="stylesheet" href="stylesheets/paths.css" media="screen" type="text/css" />
|
10
|
-
</head>
|
11
|
-
<body>
|
12
|
-
<img src="images/mango.png" />
|
13
|
-
</body>
|
14
|
-
</html>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
/* absolute */
|
2
|
-
body {
|
3
|
-
background: #fff url("http://example.com/css_images/images/apple.png") 0 0 no-repeat;
|
4
|
-
}
|
5
|
-
|
6
|
-
/* relative */
|
7
|
-
div {
|
8
|
-
background: #fff url("/css_images/images/kiwi.jpg") 0 0 no-repeat;
|
9
|
-
}
|
10
|
-
|
11
|
-
/* relative root */
|
12
|
-
ul {
|
13
|
-
background: #fff url("../images/cantaloupe.png") 0 0 no-repeat;
|
14
|
-
}
|
15
|
-
|
16
|
-
/* import */
|
17
|
-
@import url("import_paths.css");
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/* quotes */
|
2
|
-
dl {
|
3
|
-
background: #fff url("/css_images/images/apple.png") 0 0 no-repeat;
|
4
|
-
}
|
5
|
-
|
6
|
-
/* single quotes */
|
7
|
-
h1 {
|
8
|
-
background: #fff url('/css_images/images/kiwi.jpg') 0 0 no-repeat;
|
9
|
-
}
|
10
|
-
|
11
|
-
/* no quotes */
|
12
|
-
h2 {
|
13
|
-
background: #fff url(/css_images/images/cantaloupe.png) 0 0 no-repeat;
|
14
|
-
}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
|
4
|
-
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
7
|
-
<title>Color Parser</title>
|
8
|
-
|
9
|
-
<link rel="stylesheet" href="stylesheets/screen.css" media="screen" type="text/css" />
|
10
|
-
<link rel="stylesheet" href="stylesheets/print.css" media="screen" type="text/css" />
|
11
|
-
</head>
|
12
|
-
<body>
|
13
|
-
<div></div>
|
14
|
-
</body>
|
15
|
-
</html>
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,12 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
color: #444;
|
3
|
-
background-color: #535353;
|
4
|
-
}
|
5
|
-
|
6
|
-
@import url("master.css");
|
7
|
-
@import url('/css_import/stylesheets/fonts.css');
|
8
|
-
@import url(http://example.com/css_import/stylesheets/ie.css);
|
9
|
-
@import url "images.css";
|
10
|
-
@import "borders.css";
|
11
|
-
@import colors.css;
|
12
|
-
@import url("invalid.css");
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
|
4
|
-
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
7
|
-
<title>Color Parser</title>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<img src="http://example.com/inline_images/images/apple.png" />
|
11
|
-
<p>Something</p>
|
12
|
-
<img src='http://example.com/inline_images/images/kiwi.jpg' />
|
13
|
-
</body>
|
14
|
-
</html>
|
Binary file
|
Binary file
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
|
4
|
-
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
7
|
-
<title>Color Parser</title>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<img src="images/apple.png" />
|
11
|
-
<p>Something</p>
|
12
|
-
<img src='images/kiwi.jpg' />
|
13
|
-
</body>
|
14
|
-
</html>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
|
4
|
-
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
7
|
-
<title>Color Parser</title>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<img src="/inline_images/images/apple.png" />
|
11
|
-
<p>Something</p>
|
12
|
-
<img src='/inline_images/images/kiwi.jpg' />
|
13
|
-
</body>
|
14
|
-
</html>
|
data/spec/image_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Image do
|
4
|
-
before(:each) do
|
5
|
-
ColorParser.request = FakeRequest.new
|
6
|
-
end
|
7
|
-
|
8
|
-
describe "" do
|
9
|
-
it "should assign url" do
|
10
|
-
image = ColorParser::Image.new("http://example.com/foo/bar.png")
|
11
|
-
|
12
|
-
expect(image.url).to eq "http://example.com/foo/bar.png"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "" do
|
17
|
-
it "should parse host path and query from url" do
|
18
|
-
image = ColorParser::Image.new("http://example.com/foo/bar.png?baz=bar")
|
19
|
-
|
20
|
-
expect(image.host).to eq "example.com"
|
21
|
-
expect(image.path).to eq "/foo/bar.png"
|
22
|
-
expect(image.query).to eq "baz=bar"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "" do
|
27
|
-
it "should parse name" do
|
28
|
-
image = ColorParser::Image.new("http://example.com/foo/bar.png?baz=bar")
|
29
|
-
|
30
|
-
expect("bar.png").to eq image.name
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/spec/request_spec.rb
DELETED