html-table 1.4.2 → 1.5.0

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/CHANGES +155 -149
  5. data/MANIFEST +59 -59
  6. data/README +132 -132
  7. data/certs/djberg96_pub.pem +15 -15
  8. data/doc/attributes.rdoc +143 -143
  9. data/doc/table.rdoc +158 -158
  10. data/doc/table_body.rdoc +9 -9
  11. data/doc/table_caption.rdoc +9 -9
  12. data/doc/table_colgroup.rdoc +8 -8
  13. data/doc/table_colgroup_col.rdoc +9 -9
  14. data/doc/table_content.rdoc +15 -15
  15. data/doc/table_foot.rdoc +8 -8
  16. data/doc/table_head.rdoc +11 -11
  17. data/doc/table_row.rdoc +105 -105
  18. data/doc/table_row_data.rdoc +92 -92
  19. data/doc/table_row_header.rdoc +7 -7
  20. data/examples/advanced.rb +128 -128
  21. data/examples/intermediate1.rb +72 -72
  22. data/examples/intermediate2.rb +62 -62
  23. data/examples/intermediate3.rb +46 -46
  24. data/examples/simple1.rb +39 -39
  25. data/examples/simple2.rb +47 -47
  26. data/examples/simple3.rb +41 -41
  27. data/html-table.gemspec +28 -28
  28. data/lib/html-table.rb +1 -1
  29. data/lib/html/attribute_handler.rb +403 -403
  30. data/lib/html/body.rb +37 -37
  31. data/lib/html/caption.rb +49 -49
  32. data/lib/html/col.rb +41 -41
  33. data/lib/html/colgroup.rb +113 -113
  34. data/lib/html/content.rb +18 -18
  35. data/lib/html/data.rb +69 -69
  36. data/lib/html/foot.rb +49 -49
  37. data/lib/html/head.rb +49 -49
  38. data/lib/html/header.rb +65 -65
  39. data/lib/html/html_handler.rb +120 -120
  40. data/lib/html/row.rb +188 -188
  41. data/lib/html/table.rb +323 -323
  42. data/lib/html/tablesection.rb +48 -48
  43. data/lib/html/tag_handler.rb +121 -121
  44. data/test/test_attribute_handler.rb +361 -361
  45. data/test/test_body.rb +87 -87
  46. data/test/test_caption.rb +80 -80
  47. data/test/test_col.rb +40 -40
  48. data/test/test_colgroup.rb +89 -89
  49. data/test/test_data.rb +77 -77
  50. data/test/test_foot.rb +111 -111
  51. data/test/test_head.rb +104 -104
  52. data/test/test_header.rb +77 -77
  53. data/test/test_html_handler.rb +37 -37
  54. data/test/test_row.rb +141 -141
  55. data/test/test_table.rb +158 -158
  56. data/test/test_tablesection.rb +42 -42
  57. data/test/test_tag_handler.rb +90 -90
  58. metadata +22 -22
  59. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4c55a593ad7d08d0db8e0996b3d303bbc45c018
4
- data.tar.gz: bd130deeca78d6e8e92fa2a9f85f04a4ea622f93
3
+ metadata.gz: ccb27641d8cb2dad479a7d751a9c16357a4d94da
4
+ data.tar.gz: 765a7761cf6febab3b9405707bded64dedecbfc9
5
5
  SHA512:
6
- metadata.gz: cca39640c7dcbde56e1dd5347337c2f3cf04c755c64732e084ca0cf56116b57f686297459c5bc8bbb37e66674615d5707d4ebec15ca049621c9982ca621eaede
7
- data.tar.gz: 01b7690b60c9092875327c6ce69194f920f18afb63c22eb12f87c79700a7eb38da4974e594bc007b1975387ca37d9dfb55e03cf00aa72e4616a5dc413a7acfdd
6
+ metadata.gz: b8306683f34b913bb32df5c8f30eb44fe9e7b9a7b7e25d0f3700e529a3d52726719371388c06ea94ca081adbb54b852572bd8a73dca5f92f1b3a56de61892c10
7
+ data.tar.gz: 4dd31ee6569962dcf41aed60b07886e109a3868353461de3481b56f6ff3b7c9940a809adbdf22200bbf9fb95f52b4eef3bfca30050654be52371ed3ea3a96fd7
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES CHANGED
@@ -1,149 +1,155 @@
1
- == 1.4.2 - 8-Apr-2016
2
- * This gem is now signed.
3
- * Added the html-table.rb file for convenience.
4
- * Updated the gem related rake tasks.
5
- * Corrections to the README.
6
-
7
- == 1.4.1 - 8-Nov-2014
8
- * Minor updates to Rakefile and gemspec.
9
- * Use require_relative where appropriate.
10
-
11
- == 1.4.0 - 28-Aug-2013
12
- * The HTML::Table constructor now accepts an optional hash of options.
13
- If present, they are treated as table attributes.
14
- * Some Rakefile and gemspec updates.
15
- * Minor test file cleanup.
16
-
17
- == 1.3.6 - 19-Sep-2011
18
- * Fixes header.rb, data.rb and caption.rb for Ruby 1.9.
19
-
20
- == 1.3.5 - 1-Sep-2011
21
- * Refactored the Rakefile. Removed an old install task, reworked the
22
- gem tasks and added a default task.
23
- * Minor updates to the gemspec.
24
-
25
- == 1.3.4 - 29-Sep-2009
26
- * The test-unit library is now a development dependency instead of a
27
- standard dependency.
28
- * Removed all load path mangling.
29
- * License changed to Artistic 2.0.
30
- * Updated the gemspec description, added a license.
31
-
32
- == 1.3.3 - 5-Feb-2009
33
- * Added structured_warnings as a requirement. The non standard tags now
34
- raise a NonStandardExtensionWarning. These are now _always_ raised whenever
35
- used (instead of only in $VERBOSE mode), but the warning can be disabled as
36
- you see fit. See the documentation on structured_warnings for more details.
37
- * Added test-unit 2.x as a requirement.
38
- * Refactored and renamed the tests.
39
- * The gem now includes the example files.
40
- * Added additional rake tasks for the sake of testing individual portions
41
- of the html-table library instead of the all or nothing approach I had
42
- before.
43
- * Added rake tasks for running the example programs.
44
-
45
- == 1.3.2 - 15-Jul-2008
46
- * Added to_s and to_str aliases for the html method for all classes.
47
- * Some documentation updates.
48
- * Removed unnecessary presetup code from the test files that was no longer
49
- necessary thanks to Rake.
50
- * Removed the ts_all.rb file. It was no longer necessary thanks to Rake.
51
-
52
- == 1.3.1 - 8-Feb-2008
53
- * Fully qualified the HTML::Table class in the HTMLHandler module. This fix
54
- eliminates the need to 'include HTML' to actually get some code to work
55
- properly. Thanks go to Jos Backus for the spot and patch.
56
- * Added a Rakefile with tasks for testing and installation.
57
- * Removed the install.rb file. That's now handled by the Rakefile.
58
- * Cleaned up some warnings in the AttributeHandler and TagHandler modules.
59
- * Updated the MANIFEST and README files.
60
-
61
- == 1.3.0 - 2-Aug-2006
62
- * Added support for DSI style syntax, i.e. the ability to omit the explicit
63
- receiver in block form.
64
- * The content method now creates a Table::Content object behind the scenes
65
- (a subclass of String) and allows physical tags to generated on the fly
66
- via a block.
67
- * Added support for physical tags for content, e.g. <b>, <i> etc. See the
68
- documentation for more details.
69
- * Added the 'style' and 'class_' attribute handlers for you CSS lovers.
70
- * Added the 'data' alias for the 'content' method.
71
- * Added the 'header' method to the Table class so that you can explicitly
72
- generate <th> content instead of <td> content if you prefer.
73
- * The .html method now accepts an optional boolean that can be used to
74
- disable formatting. If set to true, the output will not include newlines
75
- or spaces between the tags (i.e. it will give you a single long string).
76
- * Some comment additions and tweaks.
77
-
78
- == 1.2.2 - 17-Jun-2005
79
- * Each class now defines its own content= method (rather than a generic module
80
- method that handles it). Internal change only.
81
- * The Head, Foot and Body classes now use the inherited version of content=
82
- method, instead of defining them individually (which they should have
83
- been doing all along).
84
- * Made the README and CHANGES file rdoc friendly.
85
- * Removed the .rd and html files under the 'doc' directory. All of those
86
- files have been made rdoc friendly and been given .rdoc extensions.
87
- * Some $LOAD_PATH setup changes for the test suite.
88
-
89
- == 1.2.1 - 26-Oct-2004
90
- * Documentation additions to make the code rdoc friendly.
91
- * Minor typo/bug fix in the background method of the AttributeHandler module.
92
- * Added an assertion to the test suite, mostly to make tc_all.rb work
93
- correctly (one test was causing other tests to fail due to a global
94
- setting that was made in a previous test).
95
-
96
- == 1.2.0 - 8-Aug-2004
97
- * Added the global_end_tags= class method for the Table class. This allows
98
- you to configure you want end tags or not for all classes, rather than
99
- having to configure each class individually. Note that classes which
100
- require end tags are unaffected.
101
- * Added handling for '<<' for those classes where it was appropriate (i.e.
102
- any class that also used 'push').
103
- * Minor update in the Table::Row#unshift method.
104
- * Modified the border= method in the AttributeHandler module to accept true
105
- or false as arguments. I had forgotten that you could specify 'border' as
106
- an attribute without a value.
107
- * Yet more tests.
108
-
109
- == 1.1.0 - 6-Aug-2004
110
- * Modified the constructors for all of the classes that can contain content
111
- to accept an optional argument. If present it is assumed to be content.
112
- * Fixed a bug/feature in Table::Row where it didn't allow you to add or
113
- delete Fixnums. Henceforth, Fixnum's are stringified.
114
- * The Table::ColGroup class no longer has the content or content= methods.
115
- This was illegal in 1.0.0 as well but it now raises a NoMethodError instead.
116
- * Added many more tests, including tests for attribute handlers and html
117
- handlers.
118
- * Made the modify_html method in the HtmlHandler module private. This should
119
- have no affect on your code.
120
- * Added another simple sample program under doc/examples.
121
- * Documentation updates.
122
-
123
- == 1.0.0 - 23-May-2004
124
- * No API changes - same as 0.0.4 but now officially declared "stable". The
125
- only change that was made is that each class is now in its own file.
126
-
127
- == 0.0.4 - 16-May-2004 (Beta4)
128
- * Prerequisites now include Ruby 1.8.0 or later and the StrongTyping package from
129
- Ryan Pavlik.
130
- * More stringent type checking added using the StrongTyping package.
131
- * Bug in Table::Foot class corrected.
132
- * Minor name change for included modules (AttributeHandler, HtmlHandler).
133
- * Many more tests added
134
-
135
- == 0.0.3 - 9-Jul-2003 (Beta3)
136
- * Added html_case() class method for those who want their HTML tags in upper
137
- case
138
- * Fixed up the docs, added the html docs to the core distro
139
- * Added some config info to table.rb so that this package works as expected
140
- after installation
141
-
142
- == 0.0.2 - 5-Jul-2003 (Beta2)
143
- * API completely rewritten
144
- * End tags and indentation level now configurable
145
- * Added all remaining tag types (caption, colgroup, col, tbody, tfoot and
146
- thead)
147
-
148
- == 0.0.1 11-Jun-2003 (Beta1)
149
- * Initial Release
1
+ == 1.5.0 - 29-Mar-2017
2
+ * Updated the structured_warnings dependency to 0.3.0, and modified the
3
+ warning classes to subclass the new warning types.
4
+ * The VERSION constant is now frozen.
5
+ * Updated cert file.
6
+
7
+ == 1.4.2 - 8-Apr-2016
8
+ * This gem is now signed.
9
+ * Added the html-table.rb file for convenience.
10
+ * Updated the gem related rake tasks.
11
+ * Corrections to the README.
12
+
13
+ == 1.4.1 - 8-Nov-2014
14
+ * Minor updates to Rakefile and gemspec.
15
+ * Use require_relative where appropriate.
16
+
17
+ == 1.4.0 - 28-Aug-2013
18
+ * The HTML::Table constructor now accepts an optional hash of options.
19
+ If present, they are treated as table attributes.
20
+ * Some Rakefile and gemspec updates.
21
+ * Minor test file cleanup.
22
+
23
+ == 1.3.6 - 19-Sep-2011
24
+ * Fixes header.rb, data.rb and caption.rb for Ruby 1.9.
25
+
26
+ == 1.3.5 - 1-Sep-2011
27
+ * Refactored the Rakefile. Removed an old install task, reworked the
28
+ gem tasks and added a default task.
29
+ * Minor updates to the gemspec.
30
+
31
+ == 1.3.4 - 29-Sep-2009
32
+ * The test-unit library is now a development dependency instead of a
33
+ standard dependency.
34
+ * Removed all load path mangling.
35
+ * License changed to Artistic 2.0.
36
+ * Updated the gemspec description, added a license.
37
+
38
+ == 1.3.3 - 5-Feb-2009
39
+ * Added structured_warnings as a requirement. The non standard tags now
40
+ raise a NonStandardExtensionWarning. These are now _always_ raised whenever
41
+ used (instead of only in $VERBOSE mode), but the warning can be disabled as
42
+ you see fit. See the documentation on structured_warnings for more details.
43
+ * Added test-unit 2.x as a requirement.
44
+ * Refactored and renamed the tests.
45
+ * The gem now includes the example files.
46
+ * Added additional rake tasks for the sake of testing individual portions
47
+ of the html-table library instead of the all or nothing approach I had
48
+ before.
49
+ * Added rake tasks for running the example programs.
50
+
51
+ == 1.3.2 - 15-Jul-2008
52
+ * Added to_s and to_str aliases for the html method for all classes.
53
+ * Some documentation updates.
54
+ * Removed unnecessary presetup code from the test files that was no longer
55
+ necessary thanks to Rake.
56
+ * Removed the ts_all.rb file. It was no longer necessary thanks to Rake.
57
+
58
+ == 1.3.1 - 8-Feb-2008
59
+ * Fully qualified the HTML::Table class in the HTMLHandler module. This fix
60
+ eliminates the need to 'include HTML' to actually get some code to work
61
+ properly. Thanks go to Jos Backus for the spot and patch.
62
+ * Added a Rakefile with tasks for testing and installation.
63
+ * Removed the install.rb file. That's now handled by the Rakefile.
64
+ * Cleaned up some warnings in the AttributeHandler and TagHandler modules.
65
+ * Updated the MANIFEST and README files.
66
+
67
+ == 1.3.0 - 2-Aug-2006
68
+ * Added support for DSI style syntax, i.e. the ability to omit the explicit
69
+ receiver in block form.
70
+ * The content method now creates a Table::Content object behind the scenes
71
+ (a subclass of String) and allows physical tags to generated on the fly
72
+ via a block.
73
+ * Added support for physical tags for content, e.g. <b>, <i> etc. See the
74
+ documentation for more details.
75
+ * Added the 'style' and 'class_' attribute handlers for you CSS lovers.
76
+ * Added the 'data' alias for the 'content' method.
77
+ * Added the 'header' method to the Table class so that you can explicitly
78
+ generate <th> content instead of <td> content if you prefer.
79
+ * The .html method now accepts an optional boolean that can be used to
80
+ disable formatting. If set to true, the output will not include newlines
81
+ or spaces between the tags (i.e. it will give you a single long string).
82
+ * Some comment additions and tweaks.
83
+
84
+ == 1.2.2 - 17-Jun-2005
85
+ * Each class now defines its own content= method (rather than a generic module
86
+ method that handles it). Internal change only.
87
+ * The Head, Foot and Body classes now use the inherited version of content=
88
+ method, instead of defining them individually (which they should have
89
+ been doing all along).
90
+ * Made the README and CHANGES file rdoc friendly.
91
+ * Removed the .rd and html files under the 'doc' directory. All of those
92
+ files have been made rdoc friendly and been given .rdoc extensions.
93
+ * Some $LOAD_PATH setup changes for the test suite.
94
+
95
+ == 1.2.1 - 26-Oct-2004
96
+ * Documentation additions to make the code rdoc friendly.
97
+ * Minor typo/bug fix in the background method of the AttributeHandler module.
98
+ * Added an assertion to the test suite, mostly to make tc_all.rb work
99
+ correctly (one test was causing other tests to fail due to a global
100
+ setting that was made in a previous test).
101
+
102
+ == 1.2.0 - 8-Aug-2004
103
+ * Added the global_end_tags= class method for the Table class. This allows
104
+ you to configure you want end tags or not for all classes, rather than
105
+ having to configure each class individually. Note that classes which
106
+ require end tags are unaffected.
107
+ * Added handling for '<<' for those classes where it was appropriate (i.e.
108
+ any class that also used 'push').
109
+ * Minor update in the Table::Row#unshift method.
110
+ * Modified the border= method in the AttributeHandler module to accept true
111
+ or false as arguments. I had forgotten that you could specify 'border' as
112
+ an attribute without a value.
113
+ * Yet more tests.
114
+
115
+ == 1.1.0 - 6-Aug-2004
116
+ * Modified the constructors for all of the classes that can contain content
117
+ to accept an optional argument. If present it is assumed to be content.
118
+ * Fixed a bug/feature in Table::Row where it didn't allow you to add or
119
+ delete Fixnums. Henceforth, Fixnum's are stringified.
120
+ * The Table::ColGroup class no longer has the content or content= methods.
121
+ This was illegal in 1.0.0 as well but it now raises a NoMethodError instead.
122
+ * Added many more tests, including tests for attribute handlers and html
123
+ handlers.
124
+ * Made the modify_html method in the HtmlHandler module private. This should
125
+ have no affect on your code.
126
+ * Added another simple sample program under doc/examples.
127
+ * Documentation updates.
128
+
129
+ == 1.0.0 - 23-May-2004
130
+ * No API changes - same as 0.0.4 but now officially declared "stable". The
131
+ only change that was made is that each class is now in its own file.
132
+
133
+ == 0.0.4 - 16-May-2004 (Beta4)
134
+ * Prerequisites now include Ruby 1.8.0 or later and the StrongTyping package from
135
+ Ryan Pavlik.
136
+ * More stringent type checking added using the StrongTyping package.
137
+ * Bug in Table::Foot class corrected.
138
+ * Minor name change for included modules (AttributeHandler, HtmlHandler).
139
+ * Many more tests added
140
+
141
+ == 0.0.3 - 9-Jul-2003 (Beta3)
142
+ * Added html_case() class method for those who want their HTML tags in upper
143
+ case
144
+ * Fixed up the docs, added the html docs to the core distro
145
+ * Added some config info to table.rb so that this package works as expected
146
+ after installation
147
+
148
+ == 0.0.2 - 5-Jul-2003 (Beta2)
149
+ * API completely rewritten
150
+ * End tags and indentation level now configurable
151
+ * Added all remaining tag types (caption, colgroup, col, tbody, tfoot and
152
+ thead)
153
+
154
+ == 0.0.1 11-Jun-2003 (Beta1)
155
+ * Initial Release
data/MANIFEST CHANGED
@@ -1,59 +1,59 @@
1
- MANIFEST
2
- CHANGES
3
- README
4
- Rakefile
5
- html-table.gemspec
6
-
7
- certs/djberg96_pub.pem
8
-
9
- doc/attributes.rdoc
10
- doc/table_body.rdoc
11
- doc/table_caption.rdoc
12
- doc/table_content.rdoc
13
- doc/table_colgroup.rdoc
14
- doc/table_colgroup_col.rdoc
15
- doc/table_foot.rdoc
16
- doc/table_head.rdoc
17
- doc/table_row_data.rdoc
18
- doc/table_row_header.rdoc
19
- doc/table_row.rdoc
20
- doc/table.rdoc
21
-
22
- doc/examples/advanced.rb
23
- doc/examples/intermediate1.rb
24
- doc/examples/intermediate2.rb
25
- doc/examples/intermediate3.rb
26
- doc/examples/simple1.rb
27
- doc/examples/simple2.rb
28
- doc/examples/simple3.rb
29
-
30
- lib/html-table.rb
31
- lib/html/attribute_handler.rb
32
- lib/html/body.rb
33
- lib/html/caption.rb
34
- lib/html/col.rb
35
- lib/html/colgroup.rb
36
- lib/html/content.rb
37
- lib/html/data.rb
38
- lib/html/foot.rb
39
- lib/html/head.rb
40
- lib/html/header.rb
41
- lib/html/html_handler.rb
42
- lib/html/row.rb
43
- lib/html/table.rb
44
- lib/html/tablesection.rb
45
- lib/html/tag_handler.rb
46
-
47
- test/test_attribute_handler.rb
48
- test/test_body.rb
49
- test/test_caption.rb
50
- test/test_col.rb
51
- test/test_colgroup.rb
52
- test/test_data.rb
53
- test/test_head.rb
54
- test/test_header.rb
55
- test/test_html_handler.rb
56
- test/test_row.rb
57
- test/test_table.rb
58
- test/test_tablesection.rb
59
- test/test_tag_handler.rb
1
+ MANIFEST
2
+ CHANGES
3
+ README
4
+ Rakefile
5
+ html-table.gemspec
6
+
7
+ certs/djberg96_pub.pem
8
+
9
+ doc/attributes.rdoc
10
+ doc/table_body.rdoc
11
+ doc/table_caption.rdoc
12
+ doc/table_content.rdoc
13
+ doc/table_colgroup.rdoc
14
+ doc/table_colgroup_col.rdoc
15
+ doc/table_foot.rdoc
16
+ doc/table_head.rdoc
17
+ doc/table_row_data.rdoc
18
+ doc/table_row_header.rdoc
19
+ doc/table_row.rdoc
20
+ doc/table.rdoc
21
+
22
+ doc/examples/advanced.rb
23
+ doc/examples/intermediate1.rb
24
+ doc/examples/intermediate2.rb
25
+ doc/examples/intermediate3.rb
26
+ doc/examples/simple1.rb
27
+ doc/examples/simple2.rb
28
+ doc/examples/simple3.rb
29
+
30
+ lib/html-table.rb
31
+ lib/html/attribute_handler.rb
32
+ lib/html/body.rb
33
+ lib/html/caption.rb
34
+ lib/html/col.rb
35
+ lib/html/colgroup.rb
36
+ lib/html/content.rb
37
+ lib/html/data.rb
38
+ lib/html/foot.rb
39
+ lib/html/head.rb
40
+ lib/html/header.rb
41
+ lib/html/html_handler.rb
42
+ lib/html/row.rb
43
+ lib/html/table.rb
44
+ lib/html/tablesection.rb
45
+ lib/html/tag_handler.rb
46
+
47
+ test/test_attribute_handler.rb
48
+ test/test_body.rb
49
+ test/test_caption.rb
50
+ test/test_col.rb
51
+ test/test_colgroup.rb
52
+ test/test_data.rb
53
+ test/test_head.rb
54
+ test/test_header.rb
55
+ test/test_html_handler.rb
56
+ test/test_row.rb
57
+ test/test_table.rb
58
+ test/test_tablesection.rb
59
+ test/test_tag_handler.rb
data/README CHANGED
@@ -1,132 +1,132 @@
1
- == Description
2
- An interface for generating HTML Tables with Ruby.
3
-
4
- == Prerequisites
5
- * strongtyping 2.0.6 or later
6
- * structured_warnings 0.1.1 or later
7
-
8
- == Installation
9
- gem install html-table
10
-
11
- == Synopsis
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.
56
-
57
- == Mixins
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.
60
-
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.
63
-
64
- == Notes
65
- A Table consists of Table::Row, Table::Caption, Table::ColGroup,
66
- Table::Body, Table::Foot, Table::Head and Table::Row objects.
67
-
68
- Table::Row objects in turn consist of Table::Row::Data and
69
- Table::Row::Header objects.
70
-
71
- Table::ColGroup objects consist of Table::ColGroup::Col
72
- objects.
73
-
74
- Table::Head, Table::Body and Table::Foot objects consist
75
- of Table::Row objects.
76
-
77
- String attributes are quoted. Numeric attributes are not.
78
-
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.
82
-
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.
86
-
87
- == Known Bugs
88
- None that I'm aware of. Please report bugs on the project page at:
89
-
90
- http://github.com/djberg96/html-table
91
-
92
- == Future Plans
93
- Documentation improvements (include inline links to other files).
94
-
95
- == Acknowledgements
96
- Anthony Peacock, for giving me ideas with his HTML::Table Perl module.
97
- Holden Glova and Culley Harrelson for API suggestions and comments.
98
-
99
- == License
100
- Artistic 2.0
101
-
102
- == Copyright
103
- (C) 2003-2016 Daniel J. Berger
104
- All Rights Reserved
105
-
106
- == Warranty
107
- This package is provided "as is" and without any express or
108
- implied warranties, including, without limitation, the implied
109
- warranties of merchantability and fitness for a particular purpose.
110
-
111
- == Author
112
- Daniel J. Berger
113
-
114
- == Developer's Notes
115
- Some people might be a little annoyed with the fact that I required Ryan
116
- Pavlik's strongtyping library. I'm not a big fan of strong typing myself.
117
- So, why did I do this?
118
-
119
- Normally when creating code, you setup your own rules as far as what is
120
- allowed as an argument. You publish the API, set up a good set of tests,
121
- and don't bother worrying about types because you figure people can read
122
- the API and won't go out of their way to break it. You certainly don't
123
- worry about it yourself because you're used to dynamic languages and find
124
- that you don't need the strong typing training wheels after all, right?
125
-
126
- However, HTML tables have a predefined set of rules as far as what content
127
- is valid, and where it's placed in order to be HTML 4.0 compliant. For
128
- example, if a caption is included, it should be at the 'top' of your table
129
- syntax, you can only have one foot section, and so on. I therefore chose to
130
- enforce these conventions and rules in Ruby via Ryan's module. I could have
131
- lived without it, and instead chose to do a plethora of "kind_of?" checks.
132
- However, Ryan's package is both faster and required less typing on my part.
1
+ == Description
2
+ An interface for generating HTML Tables with Ruby.
3
+
4
+ == Prerequisites
5
+ * strongtyping 2.0.6 or later
6
+ * structured_warnings 0.3.0 or later
7
+
8
+ == Installation
9
+ gem install html-table
10
+
11
+ == Synopsis
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.
56
+
57
+ == Mixins
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.
60
+
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.
63
+
64
+ == Notes
65
+ A Table consists of Table::Row, Table::Caption, Table::ColGroup,
66
+ Table::Body, Table::Foot, Table::Head and Table::Row objects.
67
+
68
+ Table::Row objects in turn consist of Table::Row::Data and
69
+ Table::Row::Header objects.
70
+
71
+ Table::ColGroup objects consist of Table::ColGroup::Col
72
+ objects.
73
+
74
+ Table::Head, Table::Body and Table::Foot objects consist
75
+ of Table::Row objects.
76
+
77
+ String attributes are quoted. Numeric attributes are not.
78
+
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.
82
+
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.
86
+
87
+ == Known Bugs
88
+ None that I'm aware of. Please report bugs on the project page at:
89
+
90
+ http://github.com/djberg96/html-table
91
+
92
+ == Future Plans
93
+ Documentation improvements (include inline links to other files).
94
+
95
+ == Acknowledgements
96
+ Anthony Peacock, for giving me ideas with his HTML::Table Perl module.
97
+ Holden Glova and Culley Harrelson for API suggestions and comments.
98
+
99
+ == License
100
+ Artistic 2.0
101
+
102
+ == Copyright
103
+ (C) 2003-2017 Daniel J. Berger
104
+ All Rights Reserved
105
+
106
+ == Warranty
107
+ This package is provided "as is" and without any express or
108
+ implied warranties, including, without limitation, the implied
109
+ warranties of merchantability and fitness for a particular purpose.
110
+
111
+ == Author
112
+ Daniel J. Berger
113
+
114
+ == Developer's Notes
115
+ Some people might be a little annoyed with the fact that I required Ryan
116
+ Pavlik's strongtyping library. I'm not a big fan of strong typing myself.
117
+ So, why did I do this?
118
+
119
+ Normally when creating code, you setup your own rules as far as what is
120
+ allowed as an argument. You publish the API, set up a good set of tests,
121
+ and don't bother worrying about types because you figure people can read
122
+ the API and won't go out of their way to break it. You certainly don't
123
+ worry about it yourself because you're used to dynamic languages and find
124
+ that you don't need the strong typing training wheels after all, right?
125
+
126
+ However, HTML tables have a predefined set of rules as far as what content
127
+ is valid, and where it's placed in order to be HTML 4.0 compliant. For
128
+ example, if a caption is included, it should be at the 'top' of your table
129
+ syntax, you can only have one foot section, and so on. I therefore chose to
130
+ enforce these conventions and rules in Ruby via Ryan's module. I could have
131
+ lived without it, and instead chose to do a plethora of "kind_of?" checks.
132
+ However, Ryan's package is both faster and required less typing on my part.