html-table 1.6.3 → 1.7.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/{CHANGES.rdoc → CHANGES.md} +76 -68
- data/Gemfile +2 -0
- data/MANIFEST.md +57 -0
- data/{README.rdoc → README.md} +80 -71
- data/Rakefile +122 -146
- data/doc/attributes.md +160 -0
- data/doc/table.md +173 -0
- data/doc/table_body.md +9 -0
- data/doc/table_caption.md +10 -0
- data/doc/table_colgroup.md +8 -0
- data/doc/table_colgroup_col.md +7 -0
- data/doc/table_content.md +17 -0
- data/doc/table_foot.md +8 -0
- data/doc/table_head.md +10 -0
- data/doc/table_row.md +114 -0
- data/doc/table_row_data.md +100 -0
- data/doc/table_row_header.md +6 -0
- data/examples/simple1.rb +7 -5
- data/html-table.gemspec +16 -11
- data/lib/html/body.rb +9 -7
- data/lib/html/caption.rb +4 -2
- data/lib/html/col.rb +37 -34
- data/lib/html/colgroup.rb +90 -97
- data/lib/html/content.rb +3 -6
- data/lib/html/data.rb +3 -1
- data/lib/html/foot.rb +53 -45
- data/lib/html/head.rb +54 -47
- data/lib/html/header.rb +5 -3
- data/lib/html/mixin/attribute_handler.rb +59 -55
- data/lib/html/mixin/html_handler.rb +33 -35
- data/lib/html/mixin/strongtyping.rb +6 -6
- data/lib/html/mixin/tag_handler.rb +6 -2
- data/lib/html/row.rb +156 -183
- data/lib/html/table.rb +45 -45
- data/lib/html/tablesection.rb +51 -46
- data/spec/attribute_handler_spec.rb +374 -0
- data/spec/body_spec.rb +98 -0
- data/spec/caption_spec.rb +83 -0
- data/spec/colgroup_col_spec.rb +34 -0
- data/spec/colgroup_spec.rb +97 -0
- data/spec/data_spec.rb +88 -0
- data/spec/foot_spec.rb +116 -0
- data/spec/head_spec.rb +116 -0
- data/spec/header_spec.rb +85 -0
- data/spec/html_handler_spec.rb +35 -0
- data/spec/row_spec.rb +163 -0
- data/spec/table_spec.rb +186 -0
- data/spec/tablesection_spec.rb +36 -0
- data/spec/tag_handler_spec.rb +85 -0
- data.tar.gz.sig +0 -0
- metadata +118 -92
- metadata.gz.sig +0 -0
- data/MANIFEST.rdoc +0 -56
- data/doc/attributes.rdoc +0 -143
- data/doc/table.rdoc +0 -156
- data/doc/table_body.rdoc +0 -9
- data/doc/table_caption.rdoc +0 -9
- data/doc/table_colgroup.rdoc +0 -8
- data/doc/table_colgroup_col.rdoc +0 -9
- data/doc/table_content.rdoc +0 -15
- data/doc/table_foot.rdoc +0 -8
- data/doc/table_head.rdoc +0 -11
- data/doc/table_row.rdoc +0 -105
- data/doc/table_row_data.rdoc +0 -92
- data/doc/table_row_header.rdoc +0 -7
- data/test/test_attribute_handler.rb +0 -361
- data/test/test_body.rb +0 -87
- data/test/test_caption.rb +0 -80
- data/test/test_col.rb +0 -40
- data/test/test_colgroup.rb +0 -89
- data/test/test_data.rb +0 -77
- data/test/test_foot.rb +0 -111
- data/test/test_head.rb +0 -104
- data/test/test_header.rb +0 -77
- data/test/test_html_handler.rb +0 -37
- data/test/test_row.rb +0 -141
- data/test/test_table.rb +0 -159
- data/test/test_tablesection.rb +0 -42
- data/test/test_tag_handler.rb +0 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82a38153cceb16ff95343d215ddfd4d76c07b88d4fd918353cb3952268e0bd10
|
4
|
+
data.tar.gz: c2e5ba27dc21ac6f5e877816aa5186446c1aac7c32c5c869dd4d11ad7e4a29eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2dd2a5e588778dd72d16099d54be08d7ec6cf7cb5ac41d427ddb876189092910394b96a6eeef8c19ba8981d788c65dbdb1147143baca4c7e5da432868d26f51
|
7
|
+
data.tar.gz: 6b8b5008c29310c29c837c0dcb3303e3c3e4a0aca99da05d191e614cdc36e7ec58afcdadb185e576772d2480b186ccb02ea165feef582472cb50283f89c9a911
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/{CHANGES.rdoc → CHANGES.md}
RENAMED
@@ -1,69 +1,77 @@
|
|
1
|
-
|
1
|
+
## 1.7.1 - 20-Jun-2025
|
2
|
+
* Mostly internal refactoring and rubocop updates.
|
3
|
+
* Switch from rdoc to markdown since github isn't rendering rdoc properly.
|
4
|
+
|
5
|
+
## 1.7.0 - 8-Sep-2020
|
6
|
+
* Switched from test-unit to rspec.
|
7
|
+
* Added a Gemfile.
|
8
|
+
|
9
|
+
## 1.6.3 - 18-Mar-2020
|
2
10
|
* Fixed the LICENSE file, which inadvertently included some unrelated
|
3
11
|
copyright notices. I also removed some unnecessary boilerplate.
|
4
12
|
* Added an explicit .rdoc extension to files that were already in that format.
|
5
13
|
|
6
|
-
|
14
|
+
## 1.6.2 - 17-Mar-2020
|
7
15
|
* Include copy of Apache-2.0 license in distribution.
|
8
16
|
|
9
|
-
|
10
|
-
* Namespace all the modules under HTML::Mixin to prevent potential clashes,
|
17
|
+
## 1.6.1 - 24-Feb-2019
|
18
|
+
* Namespace all the modules under `HTML::Mixin` to prevent potential clashes,
|
11
19
|
especially for the StrongTyping module. Thanks go to mistoo for the report.
|
12
20
|
|
13
|
-
|
14
|
-
* Changed license to Apache
|
21
|
+
## 1.6.0 - 16-Jan-2019
|
22
|
+
* Changed license to Apache-2.0.
|
15
23
|
* Removed strongtyping dependency, now comes bundled with a pure Ruby
|
16
24
|
version instead.
|
17
25
|
* Minor documentation updates.
|
18
26
|
|
19
|
-
|
27
|
+
## 1.5.2 - 4-Nov-2018
|
20
28
|
* Added metadata to gemspec.
|
21
29
|
|
22
|
-
|
30
|
+
## 1.5.1 - 31-Mar-2018
|
23
31
|
* Fixed deprecation warnings.
|
24
32
|
* Updated cert.
|
25
33
|
|
26
|
-
|
34
|
+
## 1.5.0 - 29-Mar-2017
|
27
35
|
* Updated the structured_warnings dependency to 0.3.0, and modified the
|
28
36
|
warning classes to subclass the new warning types.
|
29
37
|
* The VERSION constant is now frozen.
|
30
38
|
* Updated cert file.
|
31
39
|
|
32
|
-
|
40
|
+
## 1.4.2 - 8-Apr-2016
|
33
41
|
* This gem is now signed.
|
34
42
|
* Added the html-table.rb file for convenience.
|
35
43
|
* Updated the gem related rake tasks.
|
36
44
|
* Corrections to the README.
|
37
45
|
|
38
|
-
|
46
|
+
## 1.4.1 - 8-Nov-2014
|
39
47
|
* Minor updates to Rakefile and gemspec.
|
40
48
|
* Use require_relative where appropriate.
|
41
49
|
|
42
|
-
|
43
|
-
* The HTML::Table constructor now accepts an optional hash of options.
|
50
|
+
## 1.4.0 - 28-Aug-2013
|
51
|
+
* The `HTML::Table` constructor now accepts an optional hash of options.
|
44
52
|
If present, they are treated as table attributes.
|
45
53
|
* Some Rakefile and gemspec updates.
|
46
54
|
* Minor test file cleanup.
|
47
55
|
|
48
|
-
|
56
|
+
## 1.3.6 - 19-Sep-2011
|
49
57
|
* Fixes header.rb, data.rb and caption.rb for Ruby 1.9.
|
50
58
|
|
51
|
-
|
59
|
+
## 1.3.5 - 1-Sep-2011
|
52
60
|
* Refactored the Rakefile. Removed an old install task, reworked the
|
53
61
|
gem tasks and added a default task.
|
54
62
|
* Minor updates to the gemspec.
|
55
63
|
|
56
|
-
|
64
|
+
## 1.3.4 - 29-Sep-2009
|
57
65
|
* The test-unit library is now a development dependency instead of a
|
58
66
|
standard dependency.
|
59
67
|
* Removed all load path mangling.
|
60
|
-
* License changed to Artistic
|
68
|
+
* License changed to Artistic-2.0.
|
61
69
|
* Updated the gemspec description, added a license.
|
62
70
|
|
63
|
-
|
64
|
-
* Added structured_warnings as a requirement. The non standard tags now
|
65
|
-
raise a NonStandardExtensionWarning
|
66
|
-
used (instead of only in
|
71
|
+
## 1.3.3 - 5-Feb-2009
|
72
|
+
* Added `structured_warnings` as a requirement. The non standard tags now
|
73
|
+
raise a `NonStandardExtensionWarning`. These are now _always_ raised whenever
|
74
|
+
used (instead of only in `$VERBOSE` mode), but the warning can be disabled as
|
67
75
|
you see fit. See the documentation on structured_warnings for more details.
|
68
76
|
* Added test-unit 2.x as a requirement.
|
69
77
|
* Refactored and renamed the tests.
|
@@ -73,15 +81,15 @@
|
|
73
81
|
before.
|
74
82
|
* Added rake tasks for running the example programs.
|
75
83
|
|
76
|
-
|
84
|
+
## 1.3.2 - 15-Jul-2008
|
77
85
|
* Added to_s and to_str aliases for the html method for all classes.
|
78
86
|
* Some documentation updates.
|
79
87
|
* Removed unnecessary presetup code from the test files that was no longer
|
80
88
|
necessary thanks to Rake.
|
81
89
|
* Removed the ts_all.rb file. It was no longer necessary thanks to Rake.
|
82
90
|
|
83
|
-
|
84
|
-
* Fully qualified the HTML::Table class in the HTMLHandler module. This fix
|
91
|
+
## 1.3.1 - 8-Feb-2008
|
92
|
+
* Fully qualified the `HTML::Table` class in the `HTMLHandler` module. This fix
|
85
93
|
eliminates the need to 'include HTML' to actually get some code to work
|
86
94
|
properly. Thanks go to Jos Backus for the spot and patch.
|
87
95
|
* Added a Rakefile with tasks for testing and installation.
|
@@ -89,92 +97,92 @@
|
|
89
97
|
* Cleaned up some warnings in the AttributeHandler and TagHandler modules.
|
90
98
|
* Updated the MANIFEST and README files.
|
91
99
|
|
92
|
-
|
100
|
+
## 1.3.0 - 2-Aug-2006
|
93
101
|
* Added support for DSI style syntax, i.e. the ability to omit the explicit
|
94
102
|
receiver in block form.
|
95
|
-
* The content method now creates a Table::Content object behind the scenes
|
103
|
+
* The content method now creates a `Table::Content` object behind the scenes
|
96
104
|
(a subclass of String) and allows physical tags to generated on the fly
|
97
105
|
via a block.
|
98
|
-
* Added support for physical tags for content, e.g.
|
99
|
-
documentation for more details.
|
106
|
+
* Added support for physical tags for content, e.g. `<b>`, `<i>` etc.
|
107
|
+
See the documentation for more details.
|
100
108
|
* Added the 'style' and 'class_' attribute handlers for you CSS lovers.
|
101
109
|
* Added the 'data' alias for the 'content' method.
|
102
110
|
* Added the 'header' method to the Table class so that you can explicitly
|
103
|
-
generate
|
104
|
-
* The
|
105
|
-
disable formatting.
|
111
|
+
generate `<th>` content instead of `<td>` content if you prefer.
|
112
|
+
* The `html` singleton method now accepts an optional boolean that can be used to
|
113
|
+
disable formatting. If set to true, the output will not include newlines
|
106
114
|
or spaces between the tags (i.e. it will give you a single long string).
|
107
115
|
* Some comment additions and tweaks.
|
108
116
|
|
109
|
-
|
110
|
-
* Each class now defines its own content
|
111
|
-
method that handles it).
|
117
|
+
## 1.2.2 - 17-Jun-2005
|
118
|
+
* Each class now defines its own `content=` method (rather than a generic module
|
119
|
+
method that handles it). Internal change only.
|
112
120
|
* The Head, Foot and Body classes now use the inherited version of content=
|
113
121
|
method, instead of defining them individually (which they should have
|
114
122
|
been doing all along).
|
115
123
|
* Made the README and CHANGES file rdoc friendly.
|
116
124
|
* Removed the .rd and html files under the 'doc' directory. All of those
|
117
125
|
files have been made rdoc friendly and been given .rdoc extensions.
|
118
|
-
* Some
|
126
|
+
* Some `$LOAD_PATH` setup changes for the test suite.
|
119
127
|
|
120
|
-
|
128
|
+
## 1.2.1 - 26-Oct-2004
|
121
129
|
* Documentation additions to make the code rdoc friendly.
|
122
|
-
* Minor typo/bug fix in the background method of the AttributeHandler module.
|
130
|
+
* Minor typo/bug fix in the background method of the `AttributeHandler` module.
|
123
131
|
* Added an assertion to the test suite, mostly to make tc_all.rb work
|
124
132
|
correctly (one test was causing other tests to fail due to a global
|
125
133
|
setting that was made in a previous test).
|
126
134
|
|
127
|
-
|
128
|
-
* Added the global_end_tags
|
129
|
-
you to configure you want end tags or not for all classes, rather
|
130
|
-
having to configure each class individually.
|
135
|
+
## 1.2.0 - 8-Aug-2004
|
136
|
+
* Added the `global_end_tags=` singleton method for the Table class. This
|
137
|
+
allows you to configure you want end tags or not for all classes, rather
|
138
|
+
than having to configure each class individually. Note that classes which
|
131
139
|
require end tags are unaffected.
|
132
|
-
* Added handling for
|
133
|
-
any class that also used
|
134
|
-
* Minor update in the Table::Row#unshift method.
|
135
|
-
* Modified the border
|
136
|
-
or false as arguments.
|
140
|
+
* Added handling for `<<` for those classes where it was appropriate (i.e.
|
141
|
+
any class that also used `push`).
|
142
|
+
* Minor update in the `Table::Row#unshift` method.
|
143
|
+
* Modified the `border=` method in the AttributeHandler module to accept true
|
144
|
+
or false as arguments. I had forgotten that you could specify `border` as
|
137
145
|
an attribute without a value.
|
138
146
|
* Yet more tests.
|
139
147
|
|
140
|
-
|
148
|
+
## 1.1.0 - 6-Aug-2004
|
141
149
|
* Modified the constructors for all of the classes that can contain content
|
142
150
|
to accept an optional argument. If present it is assumed to be content.
|
143
|
-
* Fixed a bug/feature in Table::Row where it
|
144
|
-
delete Fixnums.
|
145
|
-
* The Table::ColGroup class no longer has the content or content
|
146
|
-
This was illegal in 1.0.0 as well but it now raises a NoMethodError instead.
|
151
|
+
* Fixed a bug/feature in `Table::Row` where it did not allow you to add or
|
152
|
+
delete Fixnums. Henceforth, Fixnums are stringified.
|
153
|
+
* The `Table::ColGroup` class no longer has the `content` or `content=` methods.
|
154
|
+
This was illegal in 1.0.0 as well but it now raises a `NoMethodError` instead.
|
147
155
|
* Added many more tests, including tests for attribute handlers and html
|
148
156
|
handlers.
|
149
|
-
* Made the modify_html method in the HtmlHandler module private.
|
150
|
-
have no affect on your code.
|
157
|
+
* Made the `modify_html` method in the `HtmlHandler` module private. This
|
158
|
+
should have no affect on your code.
|
151
159
|
* Added another simple sample program under doc/examples.
|
152
160
|
* Documentation updates.
|
153
161
|
|
154
|
-
|
162
|
+
## 1.0.0 - 23-May-2004
|
155
163
|
* No API changes - same as 0.0.4 but now officially declared "stable". The
|
156
164
|
only change that was made is that each class is now in its own file.
|
157
165
|
|
158
|
-
|
159
|
-
* Prerequisites now include Ruby 1.8.0 or later and the StrongTyping
|
160
|
-
Ryan Pavlik.
|
166
|
+
## 0.0.4 - 16-May-2004 (Beta4)
|
167
|
+
* Prerequisites now include Ruby 1.8.0 or later and the StrongTyping library
|
168
|
+
from Ryan Pavlik.
|
161
169
|
* More stringent type checking added using the StrongTyping package.
|
162
|
-
* Bug in Table::Foot class corrected.
|
170
|
+
* Bug in `Table::Foot` class corrected.
|
163
171
|
* Minor name change for included modules (AttributeHandler, HtmlHandler).
|
164
172
|
* Many more tests added
|
165
173
|
|
166
|
-
|
167
|
-
* Added html_case
|
168
|
-
|
169
|
-
* Fixed up the docs, added the html docs to the core distro
|
174
|
+
## 0.0.3 - 9-Jul-2003 (Beta3)
|
175
|
+
* Added the `html_case` singleton method for those who want their HTML tags
|
176
|
+
in uppercase.
|
177
|
+
* Fixed up the docs, added the html docs to the core distro.
|
170
178
|
* Added some config info to table.rb so that this package works as expected
|
171
|
-
after installation
|
179
|
+
after installation.
|
172
180
|
|
173
|
-
|
174
|
-
* API completely rewritten
|
175
|
-
* End tags and indentation level now configurable
|
181
|
+
## 0.0.2 - 5-Jul-2003 (Beta2)
|
182
|
+
* API completely rewritten.
|
183
|
+
* End tags and indentation level now configurable.
|
176
184
|
* Added all remaining tag types (caption, colgroup, col, tbody, tfoot and
|
177
|
-
thead)
|
185
|
+
thead).
|
178
186
|
|
179
|
-
|
187
|
+
## 0.0.1 11-Jun-2003 (Beta1)
|
180
188
|
* Initial Release
|
data/Gemfile
ADDED
data/MANIFEST.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
* CHANGES.md
|
2
|
+
* LICENSE
|
3
|
+
* MANIFEST.md
|
4
|
+
* README.md
|
5
|
+
* Gemfile
|
6
|
+
* Rakefile
|
7
|
+
* html-table.gemspec
|
8
|
+
* certs/djberg96_pub.pem
|
9
|
+
* doc/attributes.md
|
10
|
+
* doc/table_body.md
|
11
|
+
* doc/table_caption.md
|
12
|
+
* doc/table_content.md
|
13
|
+
* doc/table_colgroup.md
|
14
|
+
* doc/table_colgroup_col.md
|
15
|
+
* doc/table_foot.md
|
16
|
+
* doc/table_head.md
|
17
|
+
* doc/table_row_data.md
|
18
|
+
* doc/table_row_header.md
|
19
|
+
* doc/table_row.md
|
20
|
+
* doc/table.md
|
21
|
+
* doc/examples/advanced.rb
|
22
|
+
* doc/examples/intermediate1.rb
|
23
|
+
* doc/examples/intermediate2.rb
|
24
|
+
* doc/examples/intermediate3.rb
|
25
|
+
* doc/examples/simple1.rb
|
26
|
+
* doc/examples/simple2.rb
|
27
|
+
* doc/examples/simple3.rb
|
28
|
+
* lib/html-table.rb
|
29
|
+
* lib/html/body.rb
|
30
|
+
* lib/html/caption.rb
|
31
|
+
* lib/html/col.rb
|
32
|
+
* lib/html/colgroup.rb
|
33
|
+
* lib/html/content.rb
|
34
|
+
* lib/html/data.rb
|
35
|
+
* lib/html/foot.rb
|
36
|
+
* lib/html/head.rb
|
37
|
+
* lib/html/header.rb
|
38
|
+
* lib/html/row.rb
|
39
|
+
* lib/html/table.rb
|
40
|
+
* lib/html/tablesection.rb
|
41
|
+
* lib/html/mixin/attribute_handler.rb
|
42
|
+
* lib/html/mixin/html_handler.rb
|
43
|
+
* lib/html/mixin/strongtyping.rb
|
44
|
+
* lib/html/mixin/tag_handler.rb
|
45
|
+
* spec/attribute_handler_spec.rb
|
46
|
+
* spec/body_spec.rb
|
47
|
+
* spec/caption_spec.rb
|
48
|
+
* spec/col_spec.rb
|
49
|
+
* spec/colgroup_col_spec.rb
|
50
|
+
* spec/data_spec.rb
|
51
|
+
* spec/head_spec.rb
|
52
|
+
* spec/header_spec.rb
|
53
|
+
* spec/html_handler_spec.rb
|
54
|
+
* spec/row_spec.rb
|
55
|
+
* spec/table_spec.rb
|
56
|
+
* spec/tablesection_spec.rb
|
57
|
+
* spec/tag_handler_spec.rb
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,74 +1,79 @@
|
|
1
|
-
|
2
|
-
An interface for generating HTML Tables with Ruby.
|
1
|
+
[](https://github.com/djberg96/html-table/actions/workflows/ruby.yml)
|
3
2
|
|
4
|
-
|
5
|
-
|
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>
|
3
|
+
## Description
|
4
|
+
An interface for generating HTML Tables with Ruby.
|
50
5
|
|
6
|
+
## Installation
|
7
|
+
`gem install html-table`
|
8
|
+
|
9
|
+
## Installing the Trusted Cert
|
10
|
+
|
11
|
+
`gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/html-table/main/certs/djberg96_pub.pem)`
|
12
|
+
|
13
|
+
## Synopsis
|
14
|
+
```ruby
|
15
|
+
require 'html/table'
|
16
|
+
include HTML
|
17
|
+
|
18
|
+
# Explicit syntax
|
19
|
+
table = HTML::Table.new{ |t|
|
20
|
+
t.border = 1
|
21
|
+
t.bgcolor = "red"
|
22
|
+
}
|
23
|
+
|
24
|
+
# Implicit syntax
|
25
|
+
table = HTML::Table.new do
|
26
|
+
border 1
|
27
|
+
bgcolor 'red'
|
28
|
+
end
|
29
|
+
|
30
|
+
table.push Table::Row.new{ |r|
|
31
|
+
r.align = "left"
|
32
|
+
r.bgcolor = "green"
|
33
|
+
r.content = ["foo","bar","baz"]
|
34
|
+
}
|
35
|
+
|
36
|
+
row = Table::Row.new{ |r|
|
37
|
+
r.align = "right"
|
38
|
+
r.bgcolor = "blue"
|
39
|
+
r.content = "hello world"
|
40
|
+
}
|
41
|
+
|
42
|
+
table[1] = row
|
43
|
+
|
44
|
+
puts table.html
|
45
|
+
```
|
46
|
+
Output:
|
47
|
+
```html
|
48
|
+
<table border=1 bgcolor='red'>
|
49
|
+
<tr align='left' bgcolor='green'> # row 0
|
50
|
+
<td>foo</td> # column 0
|
51
|
+
<td>bar</td> # column 1
|
52
|
+
<td>baz</td> # column 2
|
53
|
+
</tr>
|
54
|
+
<tr align='right' bgcolor='blue'> # row 1
|
55
|
+
<td>hello world</td> # column 0
|
56
|
+
</tr>
|
57
|
+
</table>
|
58
|
+
```
|
51
59
|
See the 'examples' directory under 'doc' for more examples.
|
52
60
|
|
53
|
-
|
61
|
+
## Mixins
|
54
62
|
Table is a subclass of Array, and therefore mixes in Enumerable. The
|
55
|
-
|
63
|
+
`push`, `unshift` and `[]=` methods have been modified. See below for details.
|
56
64
|
|
57
|
-
Table also mixes in AttributeHandler which provides methods for adding
|
65
|
+
Table also mixes in `AttributeHandler` which provides methods for adding
|
58
66
|
attributes to each of the tag types. See attributes.rdoc for more details.
|
59
67
|
|
60
|
-
|
61
|
-
A Table consists of Table::Row
|
62
|
-
Table::Body
|
68
|
+
## Notes
|
69
|
+
A Table consists of `Table::Row`, `Table::Caption`, `Table::ColGroup,`
|
70
|
+
`Table::Body`, `Table::Foot`, `Table::Head` and `Table::Row` objects.
|
63
71
|
|
64
|
-
Table::Row objects in turn consist of Table::Row::Data and
|
65
|
-
Table::Row::Header objects.
|
72
|
+
`Table::Row` objects in turn consist of `Table::Row::Data` and `Table::Row::Header` objects.
|
66
73
|
|
67
|
-
Table::ColGroup objects consist of Table::ColGroup::Col
|
68
|
-
objects.
|
74
|
+
`Table::ColGroup` objects consist of `Table::ColGroup::Col` objects.
|
69
75
|
|
70
|
-
Table::Head
|
71
|
-
of Table::Row objects.
|
76
|
+
`Table::Head`, `Table::Body` and `Table::Foot` objects consist of `Table::Row` objects.
|
72
77
|
|
73
78
|
String attributes are quoted. Numeric attributes are not.
|
74
79
|
|
@@ -77,37 +82,41 @@ the latter case, it is case-insensitive. See the documentation on
|
|
77
82
|
specific methods for more details.
|
78
83
|
|
79
84
|
Using a non-standard extension (e.g. "background") will emit a
|
80
|
-
NonStandardExtensionWarning
|
85
|
+
`NonStandardExtensionWarning`. See the documentation for `structured_warnings`
|
81
86
|
for more information on how to control these.
|
82
87
|
|
83
|
-
|
88
|
+
## Documentation
|
89
|
+
|
90
|
+
https://djberg96.github.io/html-table/
|
91
|
+
|
92
|
+
## Known Bugs
|
84
93
|
None that I'm aware of. Please report bugs on the project page at:
|
85
94
|
|
86
95
|
http://github.com/djberg96/html-table
|
87
96
|
|
88
|
-
|
97
|
+
## Future Plans
|
89
98
|
None at this time.
|
90
99
|
|
91
|
-
|
92
|
-
Anthony Peacock, for giving me ideas with his HTML::Table Perl module.
|
100
|
+
## Acknowledgements
|
101
|
+
Anthony Peacock, for giving me ideas with his `HTML::Table` Perl module.
|
93
102
|
Holden Glova and Culley Harrelson for API suggestions and comments.
|
94
103
|
|
95
|
-
|
104
|
+
## License
|
96
105
|
Apache-2.0
|
97
106
|
|
98
|
-
|
99
|
-
(C) 2003-
|
107
|
+
## Copyright
|
108
|
+
(C) 2003-2025 Daniel J. Berger
|
100
109
|
All Rights Reserved
|
101
110
|
|
102
|
-
|
111
|
+
## Warranty
|
103
112
|
This package is provided "as is" and without any express or
|
104
113
|
implied warranties, including, without limitation, the implied
|
105
114
|
warranties of merchantability and fitness for a particular purpose.
|
106
115
|
|
107
|
-
|
116
|
+
## Author
|
108
117
|
Daniel J. Berger
|
109
118
|
|
110
|
-
|
119
|
+
## Developer's Notes
|
111
120
|
Some people might be a little annoyed with the fact that I use a
|
112
121
|
strongtyping library. I'm not a big fan of strong typing myself.
|
113
122
|
So, why did I do this?
|