shiny 0.2.0 → 0.2.1
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/lib/shiny/html.rb +40 -40
- data/spec/shiny_spec.rb +6 -6
- metadata +3 -4
- data/Rakefile +0 -13
data/lib/shiny/html.rb
CHANGED
@@ -3,45 +3,45 @@ module Shiny
|
|
3
3
|
# the 17 w3c supported color names
|
4
4
|
# http://www.w3.org/TR/CSS21/syndata.html#value-def-color
|
5
5
|
FORMATS = {
|
6
|
-
'black' =>
|
7
|
-
'silver' =>
|
8
|
-
'gray' =>
|
9
|
-
'white' =>
|
10
|
-
'maroon' =>
|
11
|
-
'red' =>
|
12
|
-
'purple' =>
|
13
|
-
'fuchsia' =>
|
14
|
-
'green' =>
|
15
|
-
'lime' =>
|
16
|
-
'olive' =>
|
17
|
-
'yellow' =>
|
18
|
-
'navy' =>
|
19
|
-
'blue' =>
|
20
|
-
'teal' =>
|
21
|
-
'aqua' =>
|
22
|
-
'orange' =>
|
23
|
-
'on_black' =>
|
24
|
-
'on_silver' =>
|
25
|
-
'on_gray' =>
|
26
|
-
'on_white' =>
|
27
|
-
'on_maroon' =>
|
28
|
-
'on_red' =>
|
29
|
-
'on_purple' =>
|
30
|
-
'on_fuchsia' =>
|
31
|
-
'on_green' =>
|
32
|
-
'on_lime' =>
|
33
|
-
'on_olive' =>
|
34
|
-
'on_yellow' =>
|
35
|
-
'on_navy' =>
|
36
|
-
'on_blue' =>
|
37
|
-
'on_teal' =>
|
38
|
-
'on_aqua' =>
|
39
|
-
'on_orange' =>
|
40
|
-
'bold' =>
|
41
|
-
'underline' =>
|
42
|
-
'overline' =>
|
43
|
-
'line_through' =>
|
44
|
-
'blink' =>
|
6
|
+
'black' => '<span style="color: black;">',
|
7
|
+
'silver' => '<span style="color: silver;">',
|
8
|
+
'gray' => '<span style="color: gray;">,',
|
9
|
+
'white' => '<span style="color: white;">',
|
10
|
+
'maroon' => '<span style="color: maroon;">',
|
11
|
+
'red' => '<span style="color: red;">',
|
12
|
+
'purple' => '<span style="color: purple;">',
|
13
|
+
'fuchsia' => '<span style="color: fuchsia;">',
|
14
|
+
'green' => '<span style="color: green;">',
|
15
|
+
'lime' => '<span style="color: lime;">',
|
16
|
+
'olive' => '<span style="color: olive;">',
|
17
|
+
'yellow' => '<span style="color: yellow;">',
|
18
|
+
'navy' => '<span style="color: navy;">',
|
19
|
+
'blue' => '<span style="color: blue;">',
|
20
|
+
'teal' => '<span style="color: teal;">',
|
21
|
+
'aqua' => '<span style="color: aqua;">',
|
22
|
+
'orange' => '<span style="color: orange;">',
|
23
|
+
'on_black' => '<span style="background-color: black;">',
|
24
|
+
'on_silver' => '<span style="background-color: silver;">',
|
25
|
+
'on_gray' => '<span style="background-color: gray;">',
|
26
|
+
'on_white' => '<span style="background-color: white;">',
|
27
|
+
'on_maroon' => '<span style="background-color: maroon;">',
|
28
|
+
'on_red' => '<span style="background-color: red;">',
|
29
|
+
'on_purple' => '<span style="background-color: purple;">',
|
30
|
+
'on_fuchsia' => '<span style="background-color: fuchsia;">',
|
31
|
+
'on_green' => '<span style="background-color: green;">',
|
32
|
+
'on_lime' => '<span style="background-color: lime;">',
|
33
|
+
'on_olive' => '<span style="background-color: olive;">',
|
34
|
+
'on_yellow' => '<span style="background-color: yellow;">',
|
35
|
+
'on_navy' => '<span style="background-color: navy;">',
|
36
|
+
'on_blue' => '<span style="background-color: blue;">',
|
37
|
+
'on_teal' => '<span style="background-color: teal;">',
|
38
|
+
'on_aqua' => '<span style="background-color: aqua;">',
|
39
|
+
'on_orange' => '<span style="background-color: orange;">',
|
40
|
+
'bold' => '<span style="font-weight: bold;">',
|
41
|
+
'underline' => '<span style="text-decoration: underline;">',
|
42
|
+
'overline' => '<span style="text-decoration: overline;">',
|
43
|
+
'line_through' => '<span style="text-decoration: line-through;">',
|
44
|
+
'blink' => '<span style="text-decoration: blink;">'
|
45
45
|
}
|
46
46
|
|
47
47
|
SPAN_BEGIN = "<span>"
|
@@ -51,7 +51,7 @@ module Shiny
|
|
51
51
|
FORMATS.each do |name, value|
|
52
52
|
class_eval <<-DEF
|
53
53
|
def #{name}
|
54
|
-
@string =
|
54
|
+
@string = '#{value}' + @string + '#{SPAN_END}'
|
55
55
|
self
|
56
56
|
end
|
57
57
|
DEF
|
data/spec/shiny_spec.rb
CHANGED
@@ -61,27 +61,27 @@ describe Shiny do
|
|
61
61
|
|
62
62
|
describe "#html" do
|
63
63
|
it 'should return a bold string' do
|
64
|
-
"bold".html.bold.should ==
|
64
|
+
"bold".html.bold.should == '<span style="font-weight: bold;">bold</span>'
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'should return a underlined string' do
|
68
|
-
"underline".html.underline.should ==
|
68
|
+
"underline".html.underline.should == '<span style="text-decoration: underline;">underline</span>'
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'should return a overlined string' do
|
72
|
-
"overline".html.overline.should ==
|
72
|
+
"overline".html.overline.should == '<span style="text-decoration: overline;">overline</span>'
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'should return a line-through string' do
|
76
|
-
"line-through".html.line_through.should ==
|
76
|
+
"line-through".html.line_through.should == '<span style="text-decoration: line-through;">line-through</span>'
|
77
77
|
end
|
78
78
|
|
79
79
|
it 'should return a blinking string' do
|
80
|
-
"blink".html.blink.should ==
|
80
|
+
"blink".html.blink.should == '<span style="text-decoration: blink;">blink</span>'
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'should clear all html formats from string' do
|
84
|
-
|
84
|
+
'<span style="font-weight: bold;">i\'m blank now!</span>'.html.blank.should == "i'm blank now!"
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Samuel Tonini
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-27 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -35,7 +35,6 @@ files:
|
|
35
35
|
- spec/shiny_spec.rb
|
36
36
|
- spec/spec_helper.rb
|
37
37
|
- LICENSE
|
38
|
-
- Rakefile
|
39
38
|
- README.rdoc
|
40
39
|
has_rdoc: true
|
41
40
|
homepage: http://github.com/zastav/shiny
|
data/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
require 'spec/rake/spectask'
|
4
|
-
|
5
|
-
spec_files = Rake::FileList["spec/**/*_spec.rb"]
|
6
|
-
|
7
|
-
desc "Run specs"
|
8
|
-
Spec::Rake::SpecTask.new do |t|
|
9
|
-
t.spec_files = spec_files
|
10
|
-
t.spec_opts = ["-c"]
|
11
|
-
end
|
12
|
-
|
13
|
-
task :default => :spec
|