html-table 1.3.4 → 1.3.5

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