html-table 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/README +97 -104
- data/Rakefile +144 -145
- data/html-table.gemspec +2 -3
- data/lib/html/table.rb +1 -1
- data/test/test_table.rb +1 -1
- metadata +41 -19
data/CHANGES
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 1.3.5 - 1-Sep-2011
|
2
|
+
* Refactored the Rakefile. Removed an old install task, reworked the
|
3
|
+
gem tasks and added a default task.
|
4
|
+
* Minor updates to the gemspec.
|
5
|
+
|
1
6
|
== 1.3.4 - 29-Sep-2009
|
2
7
|
* The test-unit library is now a development dependency instead of a
|
3
8
|
standard dependency.
|
data/README
CHANGED
@@ -1,138 +1,131 @@
|
|
1
1
|
== Description
|
2
|
-
|
2
|
+
An interface for generating HTML Tables with Ruby.
|
3
3
|
|
4
4
|
== Prerequisites
|
5
|
-
|
6
|
-
|
7
|
-
* structured_warnings 0.1.1 or later
|
5
|
+
* strongtyping 2.0.6 or later
|
6
|
+
* structured_warnings 0.1.1 or later
|
8
7
|
|
9
8
|
== Installation
|
10
|
-
|
11
|
-
gem install html-table
|
9
|
+
gem install html-table
|
12
10
|
|
13
|
-
=== Local
|
14
|
-
rake test (optional)
|
15
|
-
rake install OR rake gem_install
|
16
|
-
|
17
11
|
== Synopsis
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
12
|
+
require 'html/table'
|
13
|
+
include HTML
|
14
|
+
|
15
|
+
# Explicit syntax
|
16
|
+
table = HTML::Table.new{ |t|
|
17
|
+
t.border = 1
|
18
|
+
t.bgcolor = "red"
|
19
|
+
}
|
20
|
+
|
21
|
+
# Implicit syntax
|
22
|
+
table = HTML::Table.new do
|
23
|
+
border 1
|
24
|
+
bgcolor 'red'
|
25
|
+
end
|
26
|
+
|
27
|
+
table.push Table::Row.new{ |r|
|
28
|
+
r.align = "left"
|
29
|
+
r.bgcolor = "green"
|
30
|
+
r.content = ["foo","bar","baz"]
|
31
|
+
}
|
32
|
+
|
33
|
+
row = Table::Row.new{ |r|
|
34
|
+
r.align = "right"
|
35
|
+
r.bgcolor = "blue"
|
36
|
+
r.content = "hello world"
|
37
|
+
}
|
38
|
+
|
39
|
+
table[1] = row
|
40
|
+
|
41
|
+
puts table.html
|
42
|
+
|
43
|
+
# Output
|
44
|
+
<table border=1 bgcolor='red'>
|
45
|
+
<tr align='left' bgcolor='green'> # row 0
|
46
|
+
<td>foo</td> # column 0
|
47
|
+
<td>bar</td> # column 1
|
48
|
+
<td>baz</td> # column 2
|
49
|
+
</tr>
|
50
|
+
<tr align='right' bgcolor='blue'> # row 1
|
51
|
+
<td>hello world</td> # column 0
|
52
|
+
</tr>
|
53
|
+
</table>
|
54
|
+
|
55
|
+
See the 'examples' directory under 'doc' for more examples.
|
62
56
|
|
63
57
|
== Mixins
|
64
|
-
|
65
|
-
|
58
|
+
Table is a subclass of Array, and therefore mixes in Enumerable. The
|
59
|
+
push, unshift and []= methods have been modified. See below for details.
|
66
60
|
|
67
|
-
|
68
|
-
|
61
|
+
Table also mixes in AttributeHandler which provides methods for adding
|
62
|
+
attributes to each of the tag types. See attributes.rdoc for more details.
|
69
63
|
|
70
64
|
== Notes
|
71
|
-
|
72
|
-
|
65
|
+
A Table consists of Table::Row, Table::Caption, Table::ColGroup,
|
66
|
+
Table::Body, Table::Foot, Table::Head and Table::Row objects.
|
73
67
|
|
74
|
-
|
75
|
-
|
68
|
+
Table::Row objects in turn consist of Table::Row::Data and
|
69
|
+
Table::Row::Header objects.
|
76
70
|
|
77
|
-
|
78
|
-
|
71
|
+
Table::ColGroup objects consist of Table::ColGroup::Col
|
72
|
+
objects.
|
79
73
|
|
80
|
-
|
81
|
-
|
74
|
+
Table::Head, Table::Body and Table::Foot objects consist
|
75
|
+
of Table::Row objects.
|
82
76
|
|
83
|
-
|
77
|
+
String attributes are quoted. Numeric attributes are not.
|
84
78
|
|
85
|
-
|
86
|
-
|
87
|
-
|
79
|
+
Some attributes have type checking. Some check for valid arguments. In
|
80
|
+
the latter case, it is case-insensitive. See the documentation on
|
81
|
+
specific methods for more details.
|
88
82
|
|
89
|
-
|
90
|
-
|
91
|
-
|
83
|
+
Using a non-standard extension (e.g. "background") will emit a
|
84
|
+
NonStandardExtensionWarning. See the documentation for structured_warnings
|
85
|
+
for more information on how to control these.
|
92
86
|
|
93
87
|
== Known Bugs
|
94
|
-
|
95
|
-
|
88
|
+
None that I'm aware of. Please report bugs on the project page at
|
89
|
+
http://www.rubyforge.org/projects/shards
|
96
90
|
|
97
91
|
== Future Plans
|
98
|
-
|
92
|
+
Documentation improvements (include inline links to other files).
|
99
93
|
|
100
94
|
== Acknowledgements
|
101
|
-
|
102
|
-
|
103
|
-
Holden Glova and Culley Harrelson for API suggestions and comments.
|
95
|
+
Anthony Peacock, for giving me ideas with his HTML::Table Perl module.
|
96
|
+
Holden Glova and Culley Harrelson for API suggestions and comments.
|
104
97
|
|
105
98
|
== License
|
106
|
-
|
99
|
+
Artistic 2.0
|
107
100
|
|
108
101
|
== Copyright
|
109
|
-
|
110
|
-
|
102
|
+
(C) 2003-2011 Daniel J. Berger
|
103
|
+
All Rights Reserved
|
111
104
|
|
112
105
|
== Warranty
|
113
|
-
|
114
|
-
|
115
|
-
|
106
|
+
This package is provided "as is" and without any express or
|
107
|
+
implied warranties, including, without limitation, the implied
|
108
|
+
warranties of merchantability and fitness for a particular purpose.
|
116
109
|
|
117
110
|
== Author
|
118
|
-
|
111
|
+
Daniel J. Berger
|
119
112
|
|
120
113
|
== Developer's Notes
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
114
|
+
Some people might be a little annoyed with the fact that I required Ryan
|
115
|
+
Pavlik's strongtyping library. I'm not a big fan of strong typing myself.
|
116
|
+
So, why did I do this?
|
117
|
+
|
118
|
+
Normally when creating code, you setup your own rules as far as what is
|
119
|
+
allowed as an argument. You publish the API, set up a good set of tests,
|
120
|
+
and don't bother worrying about types because you figure people can read
|
121
|
+
the API and won't go out of their way to break it. You certainly don't
|
122
|
+
worry about it yourself because you're used to dynamic languages and find
|
123
|
+
that you don't need the strong typing training wheels after all, right?
|
124
|
+
|
125
|
+
However, HTML tables have a predefined set of rules as far as what content
|
126
|
+
is valid, and where it's placed in order to be HTML 4.0 compliant. For
|
127
|
+
example, if a caption is included, it should be at the 'top' of your table
|
128
|
+
syntax, you can only have one foot section, and so on. I therefore chose to
|
129
|
+
enforce these conventions and rules in Ruby via Ryan's module. I could have
|
130
|
+
lived without it, and instead chose to do a plethora of "kind_of?" checks.
|
131
|
+
However, Ryan's package is both faster and required less typing on my part.
|
data/Rakefile
CHANGED
@@ -1,145 +1,144 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
end
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
CLEAN.include("**/*.gem", "**/*.rbc")
|
6
|
+
|
7
|
+
namespace :gem do
|
8
|
+
desc 'Build the html-table gem'
|
9
|
+
task :create => [:clean] do
|
10
|
+
spec = eval(IO.read('html-table.gemspec'))
|
11
|
+
Gem::Builder.new(spec).build
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Install the html-table package as a gem"
|
15
|
+
task :install => [:create] do
|
16
|
+
file = Dir["*.gem"].first
|
17
|
+
sh "gem install #{file}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
namespace 'example' do
|
22
|
+
desc "Run the first simple html-table example"
|
23
|
+
task :simple1 do
|
24
|
+
sh 'ruby -Ilib examples/simple1.rb'
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Run the second simple html-table example"
|
28
|
+
task :simple2 do
|
29
|
+
sh 'ruby -Ilib examples/simple2.rb'
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Run the third simple html-table example"
|
33
|
+
task :simple3 do
|
34
|
+
sh 'ruby -Ilib examples/simple3.rb'
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Run the first intermediate html-table example"
|
38
|
+
task :intermediate1 do
|
39
|
+
sh 'ruby -Ilib examples/intermediate1.rb'
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Run the second intermediate html-table example"
|
43
|
+
task :intermediate2 do
|
44
|
+
sh 'ruby -Ilib examples/intermediate2.rb'
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "Run the advanced html-table example"
|
48
|
+
task :advanced do
|
49
|
+
sh 'ruby -Ilib examples/advanced.rb'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
Rake::TestTask.new do |t|
|
54
|
+
t.warning = true
|
55
|
+
t.verbose = true
|
56
|
+
end
|
57
|
+
|
58
|
+
namespace 'test' do
|
59
|
+
Rake::TestTask.new('attribute_handler') do |t|
|
60
|
+
t.warning = true
|
61
|
+
t.verbose = true
|
62
|
+
t.test_files = FileList['test/test_attribute_handler.rb']
|
63
|
+
end
|
64
|
+
|
65
|
+
Rake::TestTask.new('body') do |t|
|
66
|
+
t.warning = true
|
67
|
+
t.verbose = true
|
68
|
+
t.test_files = FileList['test/test_body.rb']
|
69
|
+
end
|
70
|
+
|
71
|
+
Rake::TestTask.new('caption') do |t|
|
72
|
+
t.warning = true
|
73
|
+
t.verbose = true
|
74
|
+
t.test_files = FileList['test/test_caption.rb']
|
75
|
+
end
|
76
|
+
|
77
|
+
Rake::TestTask.new('col') do |t|
|
78
|
+
t.warning = true
|
79
|
+
t.verbose = true
|
80
|
+
t.test_files = FileList['test/test_col.rb']
|
81
|
+
end
|
82
|
+
|
83
|
+
Rake::TestTask.new('colgroup') do |t|
|
84
|
+
t.warning = true
|
85
|
+
t.verbose = true
|
86
|
+
t.test_files = FileList['test/test_colgroup.rb']
|
87
|
+
end
|
88
|
+
|
89
|
+
Rake::TestTask.new('data') do |t|
|
90
|
+
t.warning = true
|
91
|
+
t.verbose = true
|
92
|
+
t.test_files = FileList['test/test_data.rb']
|
93
|
+
end
|
94
|
+
|
95
|
+
Rake::TestTask.new('foot') do |t|
|
96
|
+
t.warning = true
|
97
|
+
t.verbose = true
|
98
|
+
t.test_files = FileList['test/test_foot.rb']
|
99
|
+
end
|
100
|
+
|
101
|
+
Rake::TestTask.new('head') do |t|
|
102
|
+
t.warning = true
|
103
|
+
t.verbose = true
|
104
|
+
t.test_files = FileList['test/test_head.rb']
|
105
|
+
end
|
106
|
+
|
107
|
+
Rake::TestTask.new('header') do |t|
|
108
|
+
t.warning = true
|
109
|
+
t.verbose = true
|
110
|
+
t.test_files = FileList['test/test_header.rb']
|
111
|
+
end
|
112
|
+
|
113
|
+
Rake::TestTask.new('html_handler') do |t|
|
114
|
+
t.warning = true
|
115
|
+
t.verbose = true
|
116
|
+
t.test_files = FileList['test/test_html_handler.rb']
|
117
|
+
end
|
118
|
+
|
119
|
+
Rake::TestTask.new('row') do |t|
|
120
|
+
t.warning = true
|
121
|
+
t.verbose = true
|
122
|
+
t.test_files = FileList['test/test_row.rb']
|
123
|
+
end
|
124
|
+
|
125
|
+
Rake::TestTask.new('table') do |t|
|
126
|
+
t.warning = true
|
127
|
+
t.verbose = true
|
128
|
+
t.test_files = FileList['test/test_table.rb']
|
129
|
+
end
|
130
|
+
|
131
|
+
Rake::TestTask.new('tablesection') do |t|
|
132
|
+
t.warning = true
|
133
|
+
t.verbose = true
|
134
|
+
t.test_files = FileList['test/test_tablesection.rb']
|
135
|
+
end
|
136
|
+
|
137
|
+
Rake::TestTask.new('tag_handler') do |t|
|
138
|
+
t.warning = true
|
139
|
+
t.verbose = true
|
140
|
+
t.test_files = FileList['test/test_tag_handler.rb']
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
task :default => :test
|
data/html-table.gemspec
CHANGED
@@ -2,15 +2,14 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'html-table'
|
5
|
-
gem.version = '1.3.
|
5
|
+
gem.version = '1.3.5'
|
6
6
|
gem.author = 'Daniel J. Berger'
|
7
7
|
gem.license = 'Artistic 2.0'
|
8
8
|
gem.email = 'djberg96@gmail.com'
|
9
9
|
gem.homepage = 'http://shards.rubyforge.org'
|
10
10
|
gem.summary = 'A Ruby interface for generating HTML tables'
|
11
11
|
gem.test_files = Dir['test/*.rb']
|
12
|
-
gem.
|
13
|
-
gem.files = Dir['**/*'].reject{ |f| f.include?('CVS') }
|
12
|
+
gem.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
14
13
|
|
15
14
|
gem.rubyforge_project = 'shards'
|
16
15
|
gem.extra_rdoc_files = ['README', 'CHANGES'] + Dir['doc/*.rdoc']
|
data/lib/html/table.rb
CHANGED
data/test/test_table.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html-table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 17
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 3
|
9
|
+
- 5
|
10
|
+
version: 1.3.5
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Daniel J. Berger
|
@@ -9,39 +15,50 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
13
|
-
default_executable:
|
18
|
+
date: 2011-09-01 00:00:00 Z
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: strongtyping
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
20
25
|
requirements:
|
21
26
|
- - ">="
|
22
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
23
31
|
version: "0"
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: structured_warnings
|
27
|
-
|
28
|
-
|
29
|
-
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
30
39
|
requirements:
|
31
40
|
- - ">="
|
32
41
|
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
33
45
|
version: "0"
|
34
|
-
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
35
48
|
- !ruby/object:Gem::Dependency
|
36
49
|
name: test-unit
|
37
|
-
|
38
|
-
|
39
|
-
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
40
53
|
requirements:
|
41
54
|
- - ">="
|
42
55
|
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
43
59
|
version: "0"
|
44
|
-
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
45
62
|
description: " The html-table library provides an interface for generating HTML tables\n in a syntax comfortable to Ruby programmers, but with some enforcement\n of where certain elements can be placed.\n"
|
46
63
|
email: djberg96@gmail.com
|
47
64
|
executables: []
|
@@ -117,7 +134,6 @@ files:
|
|
117
134
|
- test/test_table.rb
|
118
135
|
- test/test_tablesection.rb
|
119
136
|
- test/test_tag_handler.rb
|
120
|
-
has_rdoc: true
|
121
137
|
homepage: http://shards.rubyforge.org
|
122
138
|
licenses:
|
123
139
|
- Artistic 2.0
|
@@ -127,21 +143,27 @@ rdoc_options: []
|
|
127
143
|
require_paths:
|
128
144
|
- lib
|
129
145
|
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
130
147
|
requirements:
|
131
148
|
- - ">="
|
132
149
|
- !ruby/object:Gem::Version
|
150
|
+
hash: 3
|
151
|
+
segments:
|
152
|
+
- 0
|
133
153
|
version: "0"
|
134
|
-
version:
|
135
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
136
156
|
requirements:
|
137
157
|
- - ">="
|
138
158
|
- !ruby/object:Gem::Version
|
159
|
+
hash: 3
|
160
|
+
segments:
|
161
|
+
- 0
|
139
162
|
version: "0"
|
140
|
-
version:
|
141
163
|
requirements: []
|
142
164
|
|
143
165
|
rubyforge_project: shards
|
144
|
-
rubygems_version: 1.
|
166
|
+
rubygems_version: 1.8.10
|
145
167
|
signing_key:
|
146
168
|
specification_version: 3
|
147
169
|
summary: A Ruby interface for generating HTML tables
|