html-table 1.5.2 → 1.7.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 → CHANGES.rdoc} +22 -0
  5. data/Gemfile +7 -0
  6. data/LICENSE +177 -0
  7. data/MANIFEST.rdoc +57 -0
  8. data/README.rdoc +132 -0
  9. data/Rakefile +117 -146
  10. data/doc/table.rdoc +2 -4
  11. data/html-table.gemspec +6 -7
  12. data/lib/html/caption.rb +2 -2
  13. data/lib/html/col.rb +2 -2
  14. data/lib/html/colgroup.rb +4 -4
  15. data/lib/html/content.rb +2 -2
  16. data/lib/html/data.rb +2 -2
  17. data/lib/html/header.rb +2 -2
  18. data/lib/html/mixin/attribute_handler.rb +407 -0
  19. data/lib/html/mixin/html_handler.rb +124 -0
  20. data/lib/html/mixin/strongtyping.rb +17 -0
  21. data/lib/html/mixin/tag_handler.rb +125 -0
  22. data/lib/html/row.rb +2 -2
  23. data/lib/html/table.rb +7 -7
  24. data/lib/html/tablesection.rb +2 -2
  25. data/spec/attribute_handler_spec.rb +360 -0
  26. data/spec/body_spec.rb +81 -0
  27. data/spec/caption_spec.rb +74 -0
  28. data/spec/colgroup_col_spec.rb +34 -0
  29. data/spec/colgroup_spec.rb +83 -0
  30. data/spec/data_spec.rb +72 -0
  31. data/spec/foot_spec.rb +104 -0
  32. data/spec/head_spec.rb +101 -0
  33. data/spec/header_spec.rb +72 -0
  34. data/spec/html_handler_spec.rb +32 -0
  35. data/spec/row_spec.rb +136 -0
  36. data/spec/table_spec.rb +152 -0
  37. data/spec/tablesection_spec.rb +36 -0
  38. data/spec/tag_handler_spec.rb +85 -0
  39. metadata +55 -66
  40. metadata.gz.sig +0 -0
  41. data/MANIFEST +0 -59
  42. data/README +0 -132
  43. data/lib/html/attribute_handler.rb +0 -403
  44. data/lib/html/html_handler.rb +0 -120
  45. data/lib/html/tag_handler.rb +0 -121
  46. data/test/test_attribute_handler.rb +0 -361
  47. data/test/test_body.rb +0 -87
  48. data/test/test_caption.rb +0 -80
  49. data/test/test_col.rb +0 -40
  50. data/test/test_colgroup.rb +0 -89
  51. data/test/test_data.rb +0 -77
  52. data/test/test_foot.rb +0 -111
  53. data/test/test_head.rb +0 -104
  54. data/test/test_header.rb +0 -77
  55. data/test/test_html_handler.rb +0 -37
  56. data/test/test_row.rb +0 -141
  57. data/test/test_table.rb +0 -159
  58. data/test/test_tablesection.rb +0 -42
  59. data/test/test_tag_handler.rb +0 -90
@@ -0,0 +1,36 @@
1
+ ######################################################
2
+ # tablesection_spec.rb
3
+ #
4
+ # Test suite for the HTML::Table::TableSection class.
5
+ ######################################################
6
+ require 'rspec'
7
+ require 'html/table'
8
+
9
+ RSpec.describe HTML::Table::TableSection do
10
+ before do
11
+ @table = Table.new
12
+ @tsection = HTML::Table::TableSection.new
13
+ end
14
+
15
+ example "indent_level" do
16
+ expect(HTML::Table::TableSection).to respond_to(:indent_level)
17
+ expect(HTML::Table::TableSection).to respond_to(:indent_level=)
18
+ expect{ HTML::Table::TableSection.indent_level = "foo" }.to raise_error(ArgumentTypeError)
19
+ expect{ HTML::Table::TableSection.indent_level = 3 }.not_to raise_error
20
+ end
21
+
22
+ example "indices" do
23
+ expect{ @tsection[0] = "foo" }.to raise_error(ArgumentTypeError)
24
+ expect{ @tsection[0] = HTML::Table::Row.new }.not_to raise_error
25
+ end
26
+
27
+ example "push" do
28
+ expect{ @tsection.push("foo") }.to raise_error(ArgumentTypeError)
29
+ expect{ @tsection.push(HTML::Table::Row.new) }.not_to raise_error
30
+ end
31
+
32
+ example "unshift" do
33
+ expect{ @tsection.unshift("foo") }.to raise_error(ArgumentTypeError)
34
+ expect{ @tsection.unshift(HTML::Table::Row.new) }.not_to raise_error
35
+ end
36
+ end
@@ -0,0 +1,85 @@
1
+ ############################################################################
2
+ # tag_handler_spec.rb
3
+ #
4
+ # Test suite for the TagHandler module. For these tests, we'll use an
5
+ # instance of the Table class where the module has been mixed in.
6
+ ############################################################################
7
+ require 'rspec'
8
+ require 'html/table'
9
+
10
+ RSpec.describe HTML::Mixin::TagHandler do
11
+ before(:all) do
12
+ BlinkWarning.disable
13
+ end
14
+
15
+ before do
16
+ @tcontent = HTML::Table::Content.new('test')
17
+ end
18
+
19
+ example "bold" do
20
+ expect(@tcontent).to respond_to(:bold)
21
+ expect(@tcontent).to respond_to(:bold=)
22
+ expect{ @tcontent.bold }.not_to raise_error
23
+ expect{ @tcontent.bold = true }.not_to raise_error
24
+ end
25
+
26
+ example "big" do
27
+ expect(@tcontent).to respond_to(:big)
28
+ expect(@tcontent).to respond_to(:big=)
29
+ expect{ @tcontent.big }.not_to raise_error
30
+ expect{ @tcontent.big = true }.not_to raise_error
31
+ end
32
+
33
+ example "blink" do
34
+ expect(@tcontent).to respond_to(:blink)
35
+ expect(@tcontent).to respond_to(:blink=)
36
+ expect{ @tcontent.blink }.not_to raise_error
37
+ expect{ @tcontent.blink = true }.not_to raise_error
38
+ end
39
+
40
+ example "italic" do
41
+ expect(@tcontent).to respond_to(:italic)
42
+ expect(@tcontent).to respond_to(:italic=)
43
+ expect{ @tcontent.italic }.not_to raise_error
44
+ expect{ @tcontent.italic = true }.not_to raise_error
45
+ end
46
+
47
+ example "strike" do
48
+ expect(@tcontent).to respond_to(:strike)
49
+ expect(@tcontent).to respond_to(:strike=)
50
+ expect{ @tcontent.strike }.not_to raise_error
51
+ expect{ @tcontent.strike = true }.not_to raise_error
52
+ end
53
+
54
+ example "sub" do
55
+ expect(@tcontent).to respond_to(:sub)
56
+ expect(@tcontent).to respond_to(:sub)
57
+ expect{ @tcontent.sub }.not_to raise_error
58
+ expect{ @tcontent.sub = true }.not_to raise_error
59
+ end
60
+
61
+ example "sup" do
62
+ expect(@tcontent).to respond_to(:sup)
63
+ expect(@tcontent).to respond_to(:sup)
64
+ expect{ @tcontent.sup }.not_to raise_error
65
+ expect{ @tcontent.sup = true }.not_to raise_error
66
+ end
67
+
68
+ example "tt" do
69
+ expect(@tcontent).to respond_to(:tt)
70
+ expect(@tcontent).to respond_to(:tt)
71
+ expect{ @tcontent.tt }.not_to raise_error
72
+ expect{ @tcontent.tt = true }.not_to raise_error
73
+ end
74
+
75
+ example "underline" do
76
+ expect(@tcontent).to respond_to(:underline)
77
+ expect(@tcontent).to respond_to(:underline)
78
+ expect{ @tcontent.underline }.not_to raise_error
79
+ expect{ @tcontent.underline = true }.not_to raise_error
80
+ end
81
+
82
+ after(:all) do
83
+ BlinkWarning.enable
84
+ end
85
+ end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-table
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -35,50 +35,36 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date: 2018-11-04 00:00:00.000000000 Z
38
+ date:
39
39
  dependencies:
40
- - !ruby/object:Gem::Dependency
41
- name: strongtyping
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- type: :runtime
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
40
  - !ruby/object:Gem::Dependency
55
41
  name: structured_warnings
56
42
  requirement: !ruby/object:Gem::Requirement
57
43
  requirements:
58
44
  - - "~>"
59
45
  - !ruby/object:Gem::Version
60
- version: 0.3.0
46
+ version: 0.4.0
61
47
  type: :runtime
62
48
  prerelease: false
63
49
  version_requirements: !ruby/object:Gem::Requirement
64
50
  requirements:
65
51
  - - "~>"
66
52
  - !ruby/object:Gem::Version
67
- version: 0.3.0
53
+ version: 0.4.0
68
54
  - !ruby/object:Gem::Dependency
69
- name: test-unit
55
+ name: rspec
70
56
  requirement: !ruby/object:Gem::Requirement
71
57
  requirements:
72
- - - ">="
58
+ - - "~>"
73
59
  - !ruby/object:Gem::Version
74
- version: '0'
60
+ version: '3.9'
75
61
  type: :development
76
62
  prerelease: false
77
63
  version_requirements: !ruby/object:Gem::Requirement
78
64
  requirements:
79
- - - ">="
65
+ - - "~>"
80
66
  - !ruby/object:Gem::Version
81
- version: '0'
67
+ version: '3.9'
82
68
  - !ruby/object:Gem::Dependency
83
69
  name: rake
84
70
  requirement: !ruby/object:Gem::Requirement
@@ -101,8 +87,8 @@ email: djberg96@gmail.com
101
87
  executables: []
102
88
  extensions: []
103
89
  extra_rdoc_files:
104
- - README
105
- - CHANGES
90
+ - README.rdoc
91
+ - CHANGES.rdoc
106
92
  - doc/table_colgroup_col.rdoc
107
93
  - doc/table_colgroup.rdoc
108
94
  - doc/table_row.rdoc
@@ -117,24 +103,22 @@ extra_rdoc_files:
117
103
  - doc/table_content.rdoc
118
104
  files:
119
105
  - html-table.gemspec
120
- - test
121
- - test/test_col.rb
122
- - test/test_colgroup.rb
123
- - test/test_data.rb
124
- - test/test_caption.rb
125
- - test/test_header.rb
126
- - test/test_head.rb
127
- - test/test_row.rb
128
- - test/test_attribute_handler.rb
129
- - test/test_table.rb
130
- - test/test_foot.rb
131
- - test/test_html_handler.rb
132
- - test/test_tablesection.rb
133
- - test/test_tag_handler.rb
134
- - test/test_body.rb
135
- - CHANGES
136
- - MANIFEST
137
- - README
106
+ - LICENSE
107
+ - spec
108
+ - spec/tag_handler_spec.rb
109
+ - spec/attribute_handler_spec.rb
110
+ - spec/colgroup_spec.rb
111
+ - spec/caption_spec.rb
112
+ - spec/row_spec.rb
113
+ - spec/head_spec.rb
114
+ - spec/colgroup_col_spec.rb
115
+ - spec/data_spec.rb
116
+ - spec/header_spec.rb
117
+ - spec/body_spec.rb
118
+ - spec/html_handler_spec.rb
119
+ - spec/table_spec.rb
120
+ - spec/tablesection_spec.rb
121
+ - spec/foot_spec.rb
138
122
  - Rakefile
139
123
  - certs
140
124
  - certs/djberg96_pub.pem
@@ -149,21 +133,25 @@ files:
149
133
  - lib
150
134
  - lib/html
151
135
  - lib/html/tablesection.rb
152
- - lib/html/attribute_handler.rb
153
136
  - lib/html/data.rb
154
137
  - lib/html/table.rb
155
138
  - lib/html/row.rb
156
139
  - lib/html/col.rb
157
140
  - lib/html/head.rb
158
141
  - lib/html/colgroup.rb
142
+ - lib/html/mixin
143
+ - lib/html/mixin/attribute_handler.rb
144
+ - lib/html/mixin/html_handler.rb
145
+ - lib/html/mixin/strongtyping.rb
146
+ - lib/html/mixin/tag_handler.rb
159
147
  - lib/html/caption.rb
160
- - lib/html/html_handler.rb
161
148
  - lib/html/content.rb
162
149
  - lib/html/foot.rb
163
- - lib/html/tag_handler.rb
164
150
  - lib/html/body.rb
165
151
  - lib/html/header.rb
166
152
  - lib/html-table.rb
153
+ - CHANGES.rdoc
154
+ - Gemfile
167
155
  - doc
168
156
  - doc/table_colgroup_col.rdoc
169
157
  - doc/table_colgroup.rdoc
@@ -177,9 +165,11 @@ files:
177
165
  - doc/table.rdoc
178
166
  - doc/table_row_header.rdoc
179
167
  - doc/table_content.rdoc
168
+ - MANIFEST.rdoc
169
+ - README.rdoc
180
170
  homepage: http://github.com/djberg96/html-table
181
171
  licenses:
182
- - Artistic 2.0
172
+ - Apache-2.0
183
173
  metadata:
184
174
  homepage_uri: https://github.com/djberg96/html-table
185
175
  bug_tracker_uri: https://github.com/djberg96/html-table/issues
@@ -187,7 +177,7 @@ metadata:
187
177
  documentation_uri: https://github.com/djberg96/html-table/wiki
188
178
  source_code_uri: https://github.com/djberg96/html-table
189
179
  wiki_uri: https://github.com/djberg96/html-table/wiki
190
- post_install_message:
180
+ post_install_message:
191
181
  rdoc_options: []
192
182
  require_paths:
193
183
  - lib
@@ -202,23 +192,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
192
  - !ruby/object:Gem::Version
203
193
  version: '0'
204
194
  requirements: []
205
- rubyforge_project:
206
- rubygems_version: 2.7.6
207
- signing_key:
195
+ rubygems_version: 3.1.4
196
+ signing_key:
208
197
  specification_version: 4
209
198
  summary: A Ruby interface for generating HTML tables
210
199
  test_files:
211
- - test/test_col.rb
212
- - test/test_colgroup.rb
213
- - test/test_data.rb
214
- - test/test_caption.rb
215
- - test/test_header.rb
216
- - test/test_head.rb
217
- - test/test_row.rb
218
- - test/test_attribute_handler.rb
219
- - test/test_table.rb
220
- - test/test_foot.rb
221
- - test/test_html_handler.rb
222
- - test/test_tablesection.rb
223
- - test/test_tag_handler.rb
224
- - test/test_body.rb
200
+ - spec/tag_handler_spec.rb
201
+ - spec/attribute_handler_spec.rb
202
+ - spec/colgroup_spec.rb
203
+ - spec/caption_spec.rb
204
+ - spec/row_spec.rb
205
+ - spec/head_spec.rb
206
+ - spec/colgroup_col_spec.rb
207
+ - spec/data_spec.rb
208
+ - spec/header_spec.rb
209
+ - spec/body_spec.rb
210
+ - spec/html_handler_spec.rb
211
+ - spec/table_spec.rb
212
+ - spec/tablesection_spec.rb
213
+ - spec/foot_spec.rb
metadata.gz.sig CHANGED
Binary file
data/MANIFEST DELETED
@@ -1,59 +0,0 @@
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 DELETED
@@ -1,132 +0,0 @@
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
- None at this time.
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-2018 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.