html-table 1.6.2 → 1.6.3
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/{CHANGES → CHANGES.rdoc} +5 -0
- data/LICENSE +0 -97
- data/MANIFEST.rdoc +56 -0
- data/README.rdoc +132 -0
- data/html-table.gemspec +2 -2
- data/lib/html/table.rb +1 -1
- data/test/test_table.rb +1 -1
- metadata +6 -6
- metadata.gz.sig +0 -0
- data/MANIFEST +0 -61
- data/README +0 -132
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d163a5d1ed51f09edd89fa52b1be03867e99fd3ed2c821662ec5372c6a39e79
|
4
|
+
data.tar.gz: 65b64e9f3b709f64a3ef03cd32b3d2e19a8c1ad9e149d9f493c03135c5add4c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 429674c5654f974992d1b3765c5cef42aefce6c2efe6ac2710c480e1d38b81483102967ab0ad5097584522dc62aab0ea625c2309c5f16f69f97bcd34c2b419af
|
7
|
+
data.tar.gz: 970fe5287e0a4310125237ed62d7ab7bb4e652ebbb129131b88e99975a6cae0eefd46fd03374463df3e8d64d64eecf5ac3cb09728ee1ad6c3d68104f0673ffba
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/{CHANGES → CHANGES.rdoc}
RENAMED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 1.6.3 - 18-Mar-2020
|
2
|
+
* Fixed the LICENSE file, which inadvertently included some unrelated
|
3
|
+
copyright notices. I also removed some unnecessary boilerplate.
|
4
|
+
* Added an explicit .rdoc extension to files that were already in that format.
|
5
|
+
|
1
6
|
== 1.6.2 - 17-Mar-2020
|
2
7
|
* Include copy of Apache-2.0 license in distribution.
|
3
8
|
|
data/LICENSE
CHANGED
@@ -175,100 +175,3 @@
|
|
175
175
|
of your accepting any such warranty or additional liability.
|
176
176
|
|
177
177
|
END OF TERMS AND CONDITIONS
|
178
|
-
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
180
|
-
|
181
|
-
To apply the Apache License to your work, attach the following
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
-
replaced with your own identifying information. (Don't include
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
185
|
-
comment syntax for the file format. We also recommend that a
|
186
|
-
file or class name and description of purpose be included on the
|
187
|
-
same "printed page" as the copyright notice for easier
|
188
|
-
identification within third-party archives.
|
189
|
-
|
190
|
-
Copyright [yyyy] [name of copyright owner]
|
191
|
-
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
-
you may not use this file except in compliance with the License.
|
194
|
-
You may obtain a copy of the License at
|
195
|
-
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
-
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
-
See the License for the specific language governing permissions and
|
202
|
-
limitations under the License.
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
Third-Party Legal Notices
|
208
|
-
=========================
|
209
|
-
|
210
|
-
public/javascripts/timeline/* is covered by the following
|
211
|
-
copyright and license notice:
|
212
|
-
|
213
|
-
(c) Copyright The SIMILE Project 2006. All rights reserved.
|
214
|
-
|
215
|
-
Redistribution and use in source and binary forms, with or without
|
216
|
-
modification, are permitted provided that the following conditions
|
217
|
-
are met:
|
218
|
-
|
219
|
-
1. Redistributions of source code must retain the above copyright
|
220
|
-
notice, this list of conditions and the following disclaimer.
|
221
|
-
|
222
|
-
2. Redistributions in binary form must reproduce the above copyright
|
223
|
-
notice, this list of conditions and the following disclaimer in the
|
224
|
-
documentation and/or other materials provided with the distribution.
|
225
|
-
|
226
|
-
3. The name of the author may not be used to endorse or promote products
|
227
|
-
derived from this software without specific prior written permission.
|
228
|
-
|
229
|
-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
230
|
-
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
231
|
-
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
232
|
-
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
233
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
234
|
-
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
235
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
236
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
237
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
238
|
-
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
239
|
-
|
240
|
-
|
241
|
-
---
|
242
|
-
|
243
|
-
|
244
|
-
Portions of tools/dba.rb are covered by the following copyright
|
245
|
-
and license notice:
|
246
|
-
|
247
|
-
Copyright (c) 2007-2012 Greg Sabino Mullane <greg@endpoint.com>.
|
248
|
-
|
249
|
-
Redistribution and use in source and binary forms, with or without
|
250
|
-
modification, are permitted provided that the following conditions are met:
|
251
|
-
|
252
|
-
1. Redistributions of source code must retain the above copyright notice,
|
253
|
-
this list of conditions and the following disclaimer.
|
254
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
255
|
-
this list of conditions and the following disclaimer in the documentation
|
256
|
-
and/or other materials provided with the distribution.
|
257
|
-
|
258
|
-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
259
|
-
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
260
|
-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
261
|
-
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
262
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
263
|
-
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
264
|
-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
265
|
-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
266
|
-
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
267
|
-
OF SUCH DAMAGE.
|
268
|
-
|
269
|
-
|
270
|
-
---
|
271
|
-
|
272
|
-
|
273
|
-
Additional third-party legal notices are contained in pertinent files
|
274
|
-
in the ManageIQ source code repository.
|
data/MANIFEST.rdoc
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
* CHANGES
|
2
|
+
* LICENSE
|
3
|
+
* MANIFEST
|
4
|
+
* README
|
5
|
+
* Rakefile
|
6
|
+
* html-table.gemspec
|
7
|
+
* certs/djberg96_pub.pem
|
8
|
+
* doc/attributes.rdoc
|
9
|
+
* doc/table_body.rdoc
|
10
|
+
* doc/table_caption.rdoc
|
11
|
+
* doc/table_content.rdoc
|
12
|
+
* doc/table_colgroup.rdoc
|
13
|
+
* doc/table_colgroup_col.rdoc
|
14
|
+
* doc/table_foot.rdoc
|
15
|
+
* doc/table_head.rdoc
|
16
|
+
* doc/table_row_data.rdoc
|
17
|
+
* doc/table_row_header.rdoc
|
18
|
+
* doc/table_row.rdoc
|
19
|
+
* doc/table.rdoc
|
20
|
+
* doc/examples/advanced.rb
|
21
|
+
* doc/examples/intermediate1.rb
|
22
|
+
* doc/examples/intermediate2.rb
|
23
|
+
* doc/examples/intermediate3.rb
|
24
|
+
* doc/examples/simple1.rb
|
25
|
+
* doc/examples/simple2.rb
|
26
|
+
* doc/examples/simple3.rb
|
27
|
+
* lib/html-table.rb
|
28
|
+
* lib/strongtyping.rb
|
29
|
+
* lib/html/attribute_handler.rb
|
30
|
+
* lib/html/body.rb
|
31
|
+
* lib/html/caption.rb
|
32
|
+
* lib/html/col.rb
|
33
|
+
* lib/html/colgroup.rb
|
34
|
+
* lib/html/content.rb
|
35
|
+
* lib/html/data.rb
|
36
|
+
* lib/html/foot.rb
|
37
|
+
* lib/html/head.rb
|
38
|
+
* lib/html/header.rb
|
39
|
+
* lib/html/html_handler.rb
|
40
|
+
* lib/html/row.rb
|
41
|
+
* lib/html/table.rb
|
42
|
+
* lib/html/tablesection.rb
|
43
|
+
* lib/html/tag_handler.rb
|
44
|
+
* test/test_attribute_handler.rb
|
45
|
+
* test/test_body.rb
|
46
|
+
* test/test_caption.rb
|
47
|
+
* test/test_col.rb
|
48
|
+
* test/test_colgroup.rb
|
49
|
+
* test/test_data.rb
|
50
|
+
* test/test_head.rb
|
51
|
+
* test/test_header.rb
|
52
|
+
* test/test_html_handler.rb
|
53
|
+
* test/test_row.rb
|
54
|
+
* test/test_table.rb
|
55
|
+
* test/test_tablesection.rb
|
56
|
+
* test/test_tag_handler.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
== Description
|
2
|
+
An interface for generating HTML Tables with Ruby.
|
3
|
+
|
4
|
+
== Installation
|
5
|
+
gem install html-table
|
6
|
+
|
7
|
+
== Synopsis
|
8
|
+
require 'html/table'
|
9
|
+
include HTML
|
10
|
+
|
11
|
+
# Explicit syntax
|
12
|
+
table = HTML::Table.new{ |t|
|
13
|
+
t.border = 1
|
14
|
+
t.bgcolor = "red"
|
15
|
+
}
|
16
|
+
|
17
|
+
# Implicit syntax
|
18
|
+
table = HTML::Table.new do
|
19
|
+
border 1
|
20
|
+
bgcolor 'red'
|
21
|
+
end
|
22
|
+
|
23
|
+
table.push Table::Row.new{ |r|
|
24
|
+
r.align = "left"
|
25
|
+
r.bgcolor = "green"
|
26
|
+
r.content = ["foo","bar","baz"]
|
27
|
+
}
|
28
|
+
|
29
|
+
row = Table::Row.new{ |r|
|
30
|
+
r.align = "right"
|
31
|
+
r.bgcolor = "blue"
|
32
|
+
r.content = "hello world"
|
33
|
+
}
|
34
|
+
|
35
|
+
table[1] = row
|
36
|
+
|
37
|
+
puts table.html
|
38
|
+
|
39
|
+
# Output
|
40
|
+
<table border=1 bgcolor='red'>
|
41
|
+
<tr align='left' bgcolor='green'> # row 0
|
42
|
+
<td>foo</td> # column 0
|
43
|
+
<td>bar</td> # column 1
|
44
|
+
<td>baz</td> # column 2
|
45
|
+
</tr>
|
46
|
+
<tr align='right' bgcolor='blue'> # row 1
|
47
|
+
<td>hello world</td> # column 0
|
48
|
+
</tr>
|
49
|
+
</table>
|
50
|
+
|
51
|
+
See the 'examples' directory under 'doc' for more examples.
|
52
|
+
|
53
|
+
== Mixins
|
54
|
+
Table is a subclass of Array, and therefore mixes in Enumerable. The
|
55
|
+
+push+, +unshift+ and []= methods have been modified. See below for details.
|
56
|
+
|
57
|
+
Table also mixes in AttributeHandler which provides methods for adding
|
58
|
+
attributes to each of the tag types. See attributes.rdoc for more details.
|
59
|
+
|
60
|
+
== Notes
|
61
|
+
A Table consists of Table::Row, Table::Caption, Table::ColGroup,
|
62
|
+
Table::Body, Table::Foot, Table::Head and Table::Row objects.
|
63
|
+
|
64
|
+
Table::Row objects in turn consist of Table::Row::Data and
|
65
|
+
Table::Row::Header objects.
|
66
|
+
|
67
|
+
Table::ColGroup objects consist of Table::ColGroup::Col
|
68
|
+
objects.
|
69
|
+
|
70
|
+
Table::Head, Table::Body and Table::Foot objects consist
|
71
|
+
of Table::Row objects.
|
72
|
+
|
73
|
+
String attributes are quoted. Numeric attributes are not.
|
74
|
+
|
75
|
+
Some attributes have type checking. Some check for valid arguments. In
|
76
|
+
the latter case, it is case-insensitive. See the documentation on
|
77
|
+
specific methods for more details.
|
78
|
+
|
79
|
+
Using a non-standard extension (e.g. "background") will emit a
|
80
|
+
NonStandardExtensionWarning. See the documentation for structured_warnings
|
81
|
+
for more information on how to control these.
|
82
|
+
|
83
|
+
== Known Bugs
|
84
|
+
None that I'm aware of. Please report bugs on the project page at:
|
85
|
+
|
86
|
+
http://github.com/djberg96/html-table
|
87
|
+
|
88
|
+
== Future Plans
|
89
|
+
None at this time.
|
90
|
+
|
91
|
+
== Acknowledgements
|
92
|
+
Anthony Peacock, for giving me ideas with his HTML::Table Perl module.
|
93
|
+
Holden Glova and Culley Harrelson for API suggestions and comments.
|
94
|
+
|
95
|
+
== License
|
96
|
+
Apache-2.0
|
97
|
+
|
98
|
+
== Copyright
|
99
|
+
(C) 2003-2020 Daniel J. Berger
|
100
|
+
All Rights Reserved
|
101
|
+
|
102
|
+
== Warranty
|
103
|
+
This package is provided "as is" and without any express or
|
104
|
+
implied warranties, including, without limitation, the implied
|
105
|
+
warranties of merchantability and fitness for a particular purpose.
|
106
|
+
|
107
|
+
== Author
|
108
|
+
Daniel J. Berger
|
109
|
+
|
110
|
+
== Developer's Notes
|
111
|
+
Some people might be a little annoyed with the fact that I use a
|
112
|
+
strongtyping library. I'm not a big fan of strong typing myself.
|
113
|
+
So, why did I do this?
|
114
|
+
|
115
|
+
Normally when creating code, you setup your own rules as far as what is
|
116
|
+
allowed as an argument. You publish the API, set up a good set of tests,
|
117
|
+
and don't bother worrying about types because you figure people can read
|
118
|
+
the API and won't go out of their way to break it. You certainly don't
|
119
|
+
worry about it yourself because you're used to dynamic languages and find
|
120
|
+
that you don't need the strong typing training wheels after all, right?
|
121
|
+
|
122
|
+
However, HTML tables have a predefined set of rules as far as what content
|
123
|
+
is valid, and where it's placed in order to be HTML compliant. For
|
124
|
+
example, if a caption is included, it should be at the 'top' of your table
|
125
|
+
syntax, you can only have one foot section, and so on. I therefore chose to
|
126
|
+
enforce these conventions and rules in Ruby via a module. I could have
|
127
|
+
lived without it, and instead chose to do a plethora of "kind_of?" checks,
|
128
|
+
but the strongtyping lib is simply more convenient all around.
|
129
|
+
|
130
|
+
UPDATE: I originally used Ryan Pavlik's strongtyping library as a dependency.
|
131
|
+
As of version 1.6.0 I now simply include a pure Ruby version with this library.
|
132
|
+
This makes it easier to work with JRuby and eliminates a dependency.
|
data/html-table.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'html-table'
|
5
|
-
spec.version = '1.6.
|
5
|
+
spec.version = '1.6.3'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
7
|
spec.license = 'Apache-2.0'
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
13
|
spec.cert_chain = ['certs/djberg96_pub.pem']
|
14
14
|
|
15
|
-
spec.extra_rdoc_files = ['README', 'CHANGES'] + Dir['doc/*.rdoc']
|
15
|
+
spec.extra_rdoc_files = ['README.rdoc', 'CHANGES.rdoc'] + Dir['doc/*.rdoc']
|
16
16
|
|
17
17
|
spec.add_dependency('structured_warnings', '~> 0.3.0')
|
18
18
|
|
data/lib/html/table.rb
CHANGED
data/test/test_table.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html-table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -87,8 +87,8 @@ email: djberg96@gmail.com
|
|
87
87
|
executables: []
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files:
|
90
|
-
- README
|
91
|
-
- CHANGES
|
90
|
+
- README.rdoc
|
91
|
+
- CHANGES.rdoc
|
92
92
|
- doc/table_colgroup_col.rdoc
|
93
93
|
- doc/table_colgroup.rdoc
|
94
94
|
- doc/table_row.rdoc
|
@@ -119,9 +119,6 @@ files:
|
|
119
119
|
- test/test_tablesection.rb
|
120
120
|
- test/test_tag_handler.rb
|
121
121
|
- test/test_body.rb
|
122
|
-
- CHANGES
|
123
|
-
- MANIFEST
|
124
|
-
- README
|
125
122
|
- Rakefile
|
126
123
|
- certs
|
127
124
|
- certs/djberg96_pub.pem
|
@@ -153,6 +150,7 @@ files:
|
|
153
150
|
- lib/html/body.rb
|
154
151
|
- lib/html/header.rb
|
155
152
|
- lib/html-table.rb
|
153
|
+
- CHANGES.rdoc
|
156
154
|
- doc
|
157
155
|
- doc/table_colgroup_col.rdoc
|
158
156
|
- doc/table_colgroup.rdoc
|
@@ -166,6 +164,8 @@ files:
|
|
166
164
|
- doc/table.rdoc
|
167
165
|
- doc/table_row_header.rdoc
|
168
166
|
- doc/table_content.rdoc
|
167
|
+
- MANIFEST.rdoc
|
168
|
+
- README.rdoc
|
169
169
|
homepage: http://github.com/djberg96/html-table
|
170
170
|
licenses:
|
171
171
|
- Apache-2.0
|
metadata.gz.sig
CHANGED
Binary file
|
data/MANIFEST
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
CHANGES
|
2
|
-
LICENSE
|
3
|
-
MANIFEST
|
4
|
-
README
|
5
|
-
Rakefile
|
6
|
-
html-table.gemspec
|
7
|
-
|
8
|
-
certs/djberg96_pub.pem
|
9
|
-
|
10
|
-
doc/attributes.rdoc
|
11
|
-
doc/table_body.rdoc
|
12
|
-
doc/table_caption.rdoc
|
13
|
-
doc/table_content.rdoc
|
14
|
-
doc/table_colgroup.rdoc
|
15
|
-
doc/table_colgroup_col.rdoc
|
16
|
-
doc/table_foot.rdoc
|
17
|
-
doc/table_head.rdoc
|
18
|
-
doc/table_row_data.rdoc
|
19
|
-
doc/table_row_header.rdoc
|
20
|
-
doc/table_row.rdoc
|
21
|
-
doc/table.rdoc
|
22
|
-
|
23
|
-
doc/examples/advanced.rb
|
24
|
-
doc/examples/intermediate1.rb
|
25
|
-
doc/examples/intermediate2.rb
|
26
|
-
doc/examples/intermediate3.rb
|
27
|
-
doc/examples/simple1.rb
|
28
|
-
doc/examples/simple2.rb
|
29
|
-
doc/examples/simple3.rb
|
30
|
-
|
31
|
-
lib/html-table.rb
|
32
|
-
lib/strongtyping.rb
|
33
|
-
lib/html/attribute_handler.rb
|
34
|
-
lib/html/body.rb
|
35
|
-
lib/html/caption.rb
|
36
|
-
lib/html/col.rb
|
37
|
-
lib/html/colgroup.rb
|
38
|
-
lib/html/content.rb
|
39
|
-
lib/html/data.rb
|
40
|
-
lib/html/foot.rb
|
41
|
-
lib/html/head.rb
|
42
|
-
lib/html/header.rb
|
43
|
-
lib/html/html_handler.rb
|
44
|
-
lib/html/row.rb
|
45
|
-
lib/html/table.rb
|
46
|
-
lib/html/tablesection.rb
|
47
|
-
lib/html/tag_handler.rb
|
48
|
-
|
49
|
-
test/test_attribute_handler.rb
|
50
|
-
test/test_body.rb
|
51
|
-
test/test_caption.rb
|
52
|
-
test/test_col.rb
|
53
|
-
test/test_colgroup.rb
|
54
|
-
test/test_data.rb
|
55
|
-
test/test_head.rb
|
56
|
-
test/test_header.rb
|
57
|
-
test/test_html_handler.rb
|
58
|
-
test/test_row.rb
|
59
|
-
test/test_table.rb
|
60
|
-
test/test_tablesection.rb
|
61
|
-
test/test_tag_handler.rb
|
data/README
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
An interface for generating HTML Tables with Ruby.
|
3
|
-
|
4
|
-
== Installation
|
5
|
-
gem install html-table
|
6
|
-
|
7
|
-
== Synopsis
|
8
|
-
require 'html/table'
|
9
|
-
include HTML
|
10
|
-
|
11
|
-
# Explicit syntax
|
12
|
-
table = HTML::Table.new{ |t|
|
13
|
-
t.border = 1
|
14
|
-
t.bgcolor = "red"
|
15
|
-
}
|
16
|
-
|
17
|
-
# Implicit syntax
|
18
|
-
table = HTML::Table.new do
|
19
|
-
border 1
|
20
|
-
bgcolor 'red'
|
21
|
-
end
|
22
|
-
|
23
|
-
table.push Table::Row.new{ |r|
|
24
|
-
r.align = "left"
|
25
|
-
r.bgcolor = "green"
|
26
|
-
r.content = ["foo","bar","baz"]
|
27
|
-
}
|
28
|
-
|
29
|
-
row = Table::Row.new{ |r|
|
30
|
-
r.align = "right"
|
31
|
-
r.bgcolor = "blue"
|
32
|
-
r.content = "hello world"
|
33
|
-
}
|
34
|
-
|
35
|
-
table[1] = row
|
36
|
-
|
37
|
-
puts table.html
|
38
|
-
|
39
|
-
# Output
|
40
|
-
<table border=1 bgcolor='red'>
|
41
|
-
<tr align='left' bgcolor='green'> # row 0
|
42
|
-
<td>foo</td> # column 0
|
43
|
-
<td>bar</td> # column 1
|
44
|
-
<td>baz</td> # column 2
|
45
|
-
</tr>
|
46
|
-
<tr align='right' bgcolor='blue'> # row 1
|
47
|
-
<td>hello world</td> # column 0
|
48
|
-
</tr>
|
49
|
-
</table>
|
50
|
-
|
51
|
-
See the 'examples' directory under 'doc' for more examples.
|
52
|
-
|
53
|
-
== Mixins
|
54
|
-
Table is a subclass of Array, and therefore mixes in Enumerable. The
|
55
|
-
push, unshift and []= methods have been modified. See below for details.
|
56
|
-
|
57
|
-
Table also mixes in AttributeHandler which provides methods for adding
|
58
|
-
attributes to each of the tag types. See attributes.rdoc for more details.
|
59
|
-
|
60
|
-
== Notes
|
61
|
-
A Table consists of Table::Row, Table::Caption, Table::ColGroup,
|
62
|
-
Table::Body, Table::Foot, Table::Head and Table::Row objects.
|
63
|
-
|
64
|
-
Table::Row objects in turn consist of Table::Row::Data and
|
65
|
-
Table::Row::Header objects.
|
66
|
-
|
67
|
-
Table::ColGroup objects consist of Table::ColGroup::Col
|
68
|
-
objects.
|
69
|
-
|
70
|
-
Table::Head, Table::Body and Table::Foot objects consist
|
71
|
-
of Table::Row objects.
|
72
|
-
|
73
|
-
String attributes are quoted. Numeric attributes are not.
|
74
|
-
|
75
|
-
Some attributes have type checking. Some check for valid arguments. In
|
76
|
-
the latter case, it is case-insensitive. See the documentation on
|
77
|
-
specific methods for more details.
|
78
|
-
|
79
|
-
Using a non-standard extension (e.g. "background") will emit a
|
80
|
-
NonStandardExtensionWarning. See the documentation for structured_warnings
|
81
|
-
for more information on how to control these.
|
82
|
-
|
83
|
-
== Known Bugs
|
84
|
-
None that I'm aware of. Please report bugs on the project page at:
|
85
|
-
|
86
|
-
http://github.com/djberg96/html-table
|
87
|
-
|
88
|
-
== Future Plans
|
89
|
-
None at this time.
|
90
|
-
|
91
|
-
== Acknowledgements
|
92
|
-
Anthony Peacock, for giving me ideas with his HTML::Table Perl module.
|
93
|
-
Holden Glova and Culley Harrelson for API suggestions and comments.
|
94
|
-
|
95
|
-
== License
|
96
|
-
Apache-2.0
|
97
|
-
|
98
|
-
== Copyright
|
99
|
-
(C) 2003-2019 Daniel J. Berger
|
100
|
-
All Rights Reserved
|
101
|
-
|
102
|
-
== Warranty
|
103
|
-
This package is provided "as is" and without any express or
|
104
|
-
implied warranties, including, without limitation, the implied
|
105
|
-
warranties of merchantability and fitness for a particular purpose.
|
106
|
-
|
107
|
-
== Author
|
108
|
-
Daniel J. Berger
|
109
|
-
|
110
|
-
== Developer's Notes
|
111
|
-
Some people might be a little annoyed with the fact that I use a
|
112
|
-
strongtyping library. I'm not a big fan of strong typing myself.
|
113
|
-
So, why did I do this?
|
114
|
-
|
115
|
-
Normally when creating code, you setup your own rules as far as what is
|
116
|
-
allowed as an argument. You publish the API, set up a good set of tests,
|
117
|
-
and don't bother worrying about types because you figure people can read
|
118
|
-
the API and won't go out of their way to break it. You certainly don't
|
119
|
-
worry about it yourself because you're used to dynamic languages and find
|
120
|
-
that you don't need the strong typing training wheels after all, right?
|
121
|
-
|
122
|
-
However, HTML tables have a predefined set of rules as far as what content
|
123
|
-
is valid, and where it's placed in order to be HTML compliant. For
|
124
|
-
example, if a caption is included, it should be at the 'top' of your table
|
125
|
-
syntax, you can only have one foot section, and so on. I therefore chose to
|
126
|
-
enforce these conventions and rules in Ruby via a module. I could have
|
127
|
-
lived without it, and instead chose to do a plethora of "kind_of?" checks,
|
128
|
-
but the strongtyping lib is simply more convenient all around.
|
129
|
-
|
130
|
-
UPDATE: I originally used Ryan Pavlik's strongtyping library as a dependency.
|
131
|
-
As of version 1.6.0 I now simply include a pure Ruby version with this library.
|
132
|
-
This makes it easier to work with JRuby and eliminates a dependency.
|