html-table 1.7.0 → 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} +73 -69
- data/Gemfile +2 -7
- data/{MANIFEST.rdoc → MANIFEST.md} +15 -15
- data/{README.rdoc → README.md} +80 -71
- data/Rakefile +7 -2
- 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 +13 -8
- 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 +57 -53
- 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 +94 -80
- data/spec/body_spec.rb +54 -37
- data/spec/caption_spec.rb +41 -32
- data/spec/colgroup_col_spec.rb +7 -7
- data/spec/colgroup_spec.rb +50 -36
- data/spec/data_spec.rb +39 -23
- data/spec/foot_spec.rb +58 -46
- data/spec/head_spec.rb +62 -47
- data/spec/header_spec.rb +35 -22
- data/spec/html_handler_spec.rb +15 -12
- data/spec/row_spec.rb +95 -68
- data/spec/table_spec.rb +65 -31
- data/spec/tablesection_spec.rb +13 -13
- data/spec/tag_handler_spec.rb +13 -13
- data.tar.gz.sig +0 -0
- metadata +103 -78
- metadata.gz.sig +0 -0
- 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/doc/attributes.rdoc
DELETED
@@ -1,143 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
A list of attributes handled by html-table. Each of the writers has a
|
3
|
-
corresponding reader unless otherwise stated.
|
4
|
-
|
5
|
-
== Attributes
|
6
|
-
abbr=(string)
|
7
|
-
Sets the value for the abbr attribute.
|
8
|
-
|
9
|
-
align=(string)
|
10
|
-
Sets the align attribute. Valid arguments are 'left', 'center' and
|
11
|
-
'right'. An ArgumentError is raised if an invalid argument is passed.
|
12
|
-
|
13
|
-
axis=(string)
|
14
|
-
Sets the value for the axis attribute.
|
15
|
-
|
16
|
-
background=(url)
|
17
|
-
Sets the background attribute. The url must be a String or a TypeError
|
18
|
-
is raised. This is a non-standard extension.
|
19
|
-
|
20
|
-
bgcolor=(color)
|
21
|
-
Sets the color for the bgcolor attribute. Hex values should still be
|
22
|
-
quoted, e.g. "#F80000".
|
23
|
-
|
24
|
-
border=(num)
|
25
|
-
Sets the value for the border attribute.
|
26
|
-
|
27
|
-
bordercolor=(color)
|
28
|
-
Sets the color for the bordercolor attribute. This is a non-standard
|
29
|
-
extension.
|
30
|
-
|
31
|
-
bordercolordark=(color)
|
32
|
-
Sets the color for the bordercolordark attribute. This is a non-standard
|
33
|
-
extension.
|
34
|
-
|
35
|
-
bordercolorlight=(color)
|
36
|
-
Sets the color for the bordercolorlight attribute. This is a non-standard
|
37
|
-
extension.
|
38
|
-
|
39
|
-
cellpadding=(num)
|
40
|
-
Sets the value for the cellpadding attribute. Raises an ArgumentError if
|
41
|
-
num.to_i is less than 0.
|
42
|
-
|
43
|
-
cellspacing=(num)
|
44
|
-
Sets the value for the cellspacing attribute. Raises an ArgumentError if
|
45
|
-
num.to_i is less than 0.
|
46
|
-
|
47
|
-
char=(character)
|
48
|
-
Sets the value for the char attribute. An ArgumentError is raised if the
|
49
|
-
argument passed has a length greater than 1 (i.e. it may only be a char).
|
50
|
-
|
51
|
-
charoff=(value)
|
52
|
-
Sets the value for the charoff attribute.
|
53
|
-
|
54
|
-
colspan=(num)
|
55
|
-
Sets the colspan attribute.
|
56
|
-
|
57
|
-
content=(*args)
|
58
|
-
The behavior of this method varies largely based on the type of instance
|
59
|
-
that invokes it. Here are the rules for each +arg+ in +args+:
|
60
|
-
|
61
|
-
+Table+:
|
62
|
-
|
63
|
-
If +arg+ is a Row, Head, Foot, Body or ColGroup object, it is
|
64
|
-
pushed onto the table. If +arg+ is a string, one Row object with
|
65
|
-
one one Data object is pushed onto the Table. If +arg+ is an Array,
|
66
|
-
one Row object is created and each element of the array is pushed
|
67
|
-
onto that Row.
|
68
|
-
|
69
|
-
+Table::Row+:
|
70
|
-
|
71
|
-
If +arg+ is a Header or Data object, it is pushed onto the Row. If
|
72
|
-
+arg+ is a String, it is created as a single Data object. Attempts
|
73
|
-
to assign any other type will raise a TypeError.
|
74
|
-
|
75
|
-
+Table::Head, Table::Foot, Table::Body+:
|
76
|
-
|
77
|
-
Behave identically to Table::Row except that they accept Table::Row
|
78
|
-
objects as well.
|
79
|
-
|
80
|
-
+Table::ColGroup+:
|
81
|
-
|
82
|
-
Behaves identically to Table::Row except that it only accepts Col objects.
|
83
|
-
|
84
|
-
+Table::Col+:
|
85
|
-
|
86
|
-
This method is undefined for Table::Col, because they do not accept
|
87
|
-
content.
|
88
|
-
|
89
|
-
+Table::Data and Table::Header+:
|
90
|
-
|
91
|
-
Sets the text string for the Data or Header object. Arrays are join'd.
|
92
|
-
Any other type raises a TypeError.
|
93
|
-
|
94
|
-
frame=(type)
|
95
|
-
Sets the value for the frame attribute. Valid values are border, void,
|
96
|
-
above, below, hsides, lhs, rhs, vsides, and box. An ArgumentError is
|
97
|
-
raised if an invalid type is detected.
|
98
|
-
|
99
|
-
height=(num)
|
100
|
-
Sets the value for the height attribute. Raises an ArgumentError if
|
101
|
-
num.to_i is less than 0.
|
102
|
-
|
103
|
-
hspace=(num)
|
104
|
-
Sets the value for the hspace attribute. Raises an ArgumentError if
|
105
|
-
num.to_i is less than 0.
|
106
|
-
|
107
|
-
nowrap=(bool)
|
108
|
-
Sets the value for the nowrap attribute. Setting it to true means it will
|
109
|
-
be included as an attribute for the Table object. The default is false
|
110
|
-
(i.e. not included).
|
111
|
-
|
112
|
-
rowspan=(num)
|
113
|
-
Sets the value for the rowspan attribute.
|
114
|
-
|
115
|
-
rules=(edges)
|
116
|
-
Sets the value for the rules attribute. Valid values are all, groups,
|
117
|
-
rows, cols, or none. An ArgumentError is raised if an invalid edges value
|
118
|
-
is detected.
|
119
|
-
|
120
|
-
scope=(scope)
|
121
|
-
Sets the value for the scope attribute. Valid values for +scope+ are
|
122
|
-
row, col, rowgroup or colgroup. An ArgumentError is raised if an invalid
|
123
|
-
scope value is passed.
|
124
|
-
|
125
|
-
span=(num)
|
126
|
-
Sets the span attribute. If num.to_i is less than 0, and ArgumentError
|
127
|
-
is raised.
|
128
|
-
|
129
|
-
summary=(string)
|
130
|
-
Sets the value for the summary attribute.
|
131
|
-
|
132
|
-
valign=(position)
|
133
|
-
Sets the value for the valign attribute. Valid values are top, center,
|
134
|
-
bottom, and baseline. This is a non-standard extension.
|
135
|
-
|
136
|
-
vspace=(num)
|
137
|
-
Sets the value for the vspace attribute. This is a non-standard
|
138
|
-
extension.
|
139
|
-
|
140
|
-
width=(num)
|
141
|
-
Sets the value for the width attribute. If num is in 'x%' format, it
|
142
|
-
is retained as a string. If num is a Fixnum (or stringified number), an
|
143
|
-
ArgumentError is raised if num.to_i is less than 0.
|
data/doc/table.rdoc
DELETED
@@ -1,156 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
An interface for generating HTML Tables with Ruby.
|
3
|
-
|
4
|
-
== Synopsis
|
5
|
-
require "html/table"
|
6
|
-
include HTML
|
7
|
-
|
8
|
-
table = HTML::Table.new{ |t|
|
9
|
-
t.border = 1
|
10
|
-
t.bgcolor = "red"
|
11
|
-
}
|
12
|
-
|
13
|
-
table.push Table::Row.new{ |r|
|
14
|
-
r.align = "left"
|
15
|
-
r.bgcolor = "green"
|
16
|
-
r.content = ["foo","bar","baz"]
|
17
|
-
}
|
18
|
-
|
19
|
-
row = Table::Row.new{ |r|
|
20
|
-
r.align = "right"
|
21
|
-
r.bgcolor = "blue"
|
22
|
-
r.content = "hello world"
|
23
|
-
}
|
24
|
-
|
25
|
-
table[1] = row
|
26
|
-
|
27
|
-
puts table.html
|
28
|
-
|
29
|
-
#### output ####
|
30
|
-
<table border=1 bgcolor='red'>
|
31
|
-
<tr align='left' bgcolor='green'> # row 0
|
32
|
-
<td>foo</td> # column 0
|
33
|
-
<td>bar</td> # column 1
|
34
|
-
<td>baz</td> # column 2
|
35
|
-
</tr>
|
36
|
-
<tr align='right' bgcolor='blue'> # row 1
|
37
|
-
<td>hello world</td> # column 0
|
38
|
-
</tr>
|
39
|
-
</table>
|
40
|
-
|
41
|
-
See the 'examples' directory for more examples.
|
42
|
-
|
43
|
-
== Mixins
|
44
|
-
Table is a subclass of Array, and therefore mixes in Enumerable. The
|
45
|
-
push, unshift and []= methods have been modified. See below for details.
|
46
|
-
|
47
|
-
Table also mixes in the AttributeHandler module which provides methods
|
48
|
-
for adding attributes to each of the tag types. See attributes.rdoc for
|
49
|
-
more details.
|
50
|
-
|
51
|
-
== Constants
|
52
|
-
VERSION
|
53
|
-
The current version number (a String). This serves as the VERSION number
|
54
|
-
for the entire html-table package.
|
55
|
-
|
56
|
-
== Class Methods
|
57
|
-
Table.new(arg=nil)
|
58
|
-
Table.new(arg=nil){ |t| ... }
|
59
|
-
Creates a new Table instance. You can set attributes for the Table by
|
60
|
-
passing a block.
|
61
|
-
|
62
|
-
If +arg+ is supplied, it is automatically interpreted to be content. This
|
63
|
-
is a shortcut for Table.new{ |t| t.content = '...' }.
|
64
|
-
|
65
|
-
Table.global_end_tags?
|
66
|
-
Returns the value of the global_end_tags class variable. By default,
|
67
|
-
this is true.
|
68
|
-
|
69
|
-
Table.global_end_tags=(true|false)
|
70
|
-
Sets the global_end_tags class variable. This determines class-wide, for
|
71
|
-
those classes where end tags are optional, whether or not end tags are
|
72
|
-
included in the final html. Classes where end tags are not optional are
|
73
|
-
not affected.
|
74
|
-
|
75
|
-
If set to false, this overrides individual class end tags settings.
|
76
|
-
|
77
|
-
== Instance Methods
|
78
|
-
Table#[]=(index, object)
|
79
|
-
Assigns +object+ to +index+. There are restrictions to the data
|
80
|
-
types that you can assign to a Table instance. They include Caption,
|
81
|
-
ColGroup, Body, Foot, Head and Row. You cannot assign a slice (yet).
|
82
|
-
|
83
|
-
Table#configure(row_num, col_num=0){ |td_object| block }
|
84
|
-
Configures column +col_num+ at row +row_num+, using a block to set
|
85
|
-
options. If only +row_num+ is specified, then you'll be configuring
|
86
|
-
only the row. Generally speaking, that means you'll be configure a
|
87
|
-
Table::Row and not a Data or Header object.
|
88
|
-
|
89
|
-
Table#content
|
90
|
-
Returns the HTML content.
|
91
|
-
|
92
|
-
Table#content=(arg)
|
93
|
-
Adds data to the Table. The +arg+ may be a Table::Row object, an
|
94
|
-
Array of Table::Row objects, an Array of Array's, an Array of Strings,
|
95
|
-
or a single String. In the last two cases, a single Table::Row with a
|
96
|
-
single Table::Row::Data object is created, with the string as the content.
|
97
|
-
|
98
|
-
Table#html
|
99
|
-
Returns the entire HTML content for the Table Object. This is what you
|
100
|
-
want to print when you're done creating your Table.
|
101
|
-
|
102
|
-
Table#push(obj)
|
103
|
-
Pushes +obj+ onto the Table, where +obj+ must be a Row, Caption,
|
104
|
-
ColGroup, Body, Foot or Head object. Also note that the Caption and Head
|
105
|
-
objects will automatically put themselves at row 0 (or possibly 1, in the
|
106
|
-
case of a Head object where a Caption already exists).
|
107
|
-
|
108
|
-
Table#unshift(obj)
|
109
|
-
Unshifts +obj+ onto the Table. The same rules apply to unshift as
|
110
|
-
they do to push.
|
111
|
-
|
112
|
-
== Notes
|
113
|
-
A Table consists of Table::Row, Table::Caption, Table::ColGroup,
|
114
|
-
Table::Body, Table::Foot, Table::Head and Table::Row objects. Table::Row
|
115
|
-
objects in turn consist of Table::Row::Data and Table::Row::Header
|
116
|
-
objects. Table::ColGroup objects consist of Table::ColGroup::Col
|
117
|
-
objects. Table::Head, Table::Body and Table::Foot objects consist
|
118
|
-
of Table::Row objects.
|
119
|
-
|
120
|
-
String attributes are quoted. Numeric attributes are not.
|
121
|
-
|
122
|
-
Some attributes have type checking. Some check for valid arguments. In
|
123
|
-
the latter case, it is case-insensitive. See the documentation on
|
124
|
-
specific methods for more details.
|
125
|
-
|
126
|
-
Using a non-standard extension (e.g. "background") will send a warning to
|
127
|
-
STDERR in $VERBOSE (-w) mode.
|
128
|
-
|
129
|
-
== Known Bugs
|
130
|
-
None that I'm aware of. Please report bugs on the project page at
|
131
|
-
http://www.rubyforge.org/projects/shards.
|
132
|
-
|
133
|
-
== Future Plans
|
134
|
-
Allow standard html tags to be added to elements as appropriate, such
|
135
|
-
as <B>, <I>, etc.
|
136
|
-
|
137
|
-
CSS support.
|
138
|
-
|
139
|
-
== Acknowledgements
|
140
|
-
Anthony Peacock, for giving me ideas with his HTML::Table Perl module.
|
141
|
-
Holden Glova and Culley Harrelson for API suggestions and comments.
|
142
|
-
|
143
|
-
== License
|
144
|
-
Apache-2.0
|
145
|
-
|
146
|
-
== Copyright
|
147
|
-
(C) 2003-2019 Daniel J. Berger
|
148
|
-
All Rights Reserved
|
149
|
-
|
150
|
-
== Warranty
|
151
|
-
This package is provided "as is" and without any express or
|
152
|
-
implied warranties, including, without limitation, the implied
|
153
|
-
warranties of merchantability and fitness for a particular purpose.
|
154
|
-
|
155
|
-
== Author
|
156
|
-
Daniel J. Berger
|
data/doc/table_body.rdoc
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
A Table::Body object represents a single <TBODY></TBODY> instance for an
|
3
|
-
HTML Table.
|
4
|
-
== Notes
|
5
|
-
In virtually every respect the Table::Body class is identical to
|
6
|
-
the Table or Table::Row class. Unlike Table::Foot or Table::Head, there
|
7
|
-
can be more than one instance (i.e. it's not a singleton class).
|
8
|
-
|
9
|
-
A Table::Body contains Table::Row objects.
|
data/doc/table_caption.rdoc
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
A Table::Caption object represents a single <CAPTION></CAPTION> instance
|
3
|
-
for an HTML Table.
|
4
|
-
== Notes
|
5
|
-
The Table::Caption class is virtually identical to the Table::Row::Data
|
6
|
-
class. There is one important behavioral difference, however. First,
|
7
|
-
there can only be one Table::Caption. If you attempt to add a second one,
|
8
|
-
it will merely overwrite the existing one. Second, a Table::Caption is
|
9
|
-
always bumped to index 0.
|
data/doc/table_colgroup.rdoc
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
A Table::ColGroup object represents a single <COLGROUP></COLGROUP>
|
3
|
-
instance for an HTML Table.
|
4
|
-
|
5
|
-
== Notes
|
6
|
-
In virtually every respect the Table::ColGroup class is identical to the
|
7
|
-
Table::Row class. The only difference, beyond the begin and end tags, is
|
8
|
-
that a ColGroup may only contain instances of the Col class.
|
data/doc/table_colgroup_col.rdoc
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
A Table::ColGroup::Col object represents a single <COL> instance for an
|
3
|
-
HTML Table.
|
4
|
-
|
5
|
-
== Notes
|
6
|
-
In virtually every respect the Table::ColGroup::Col class is identical to
|
7
|
-
the Table::Row::Data class. The only differences are that a
|
8
|
-
Table::ColGroup::Col instance does not contain any content, nor does it
|
9
|
-
include an end tag.
|
data/doc/table_content.rdoc
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
A Table::Content is a wrapper for content used for Table::Row::Data and
|
3
|
-
Table::Row::Header objects. Although it can be instantiated directly, in
|
4
|
-
practice it is autogenerated for you.
|
5
|
-
|
6
|
-
== Notes
|
7
|
-
Table::Content is a subclass of String and was mostly created in order
|
8
|
-
to support a DSL style syntax as well as physical tags.
|
9
|
-
|
10
|
-
== Synopsis
|
11
|
-
content = Table::Content.new('my content') do
|
12
|
-
bold true
|
13
|
-
italics true
|
14
|
-
underline true
|
15
|
-
end
|
data/doc/table_foot.rdoc
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
A Table::Foot object represents a single <TFOOT></TFOOT> instance for an
|
3
|
-
HTML Table.
|
4
|
-
== Notes
|
5
|
-
In virtually every respect the Table::Foot class is identical to
|
6
|
-
the Table or Table::Row class. There is one significant difference.
|
7
|
-
The Table::Foot class is a singleton. There can be only one
|
8
|
-
Table::Foot instance per table.
|
data/doc/table_head.rdoc
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
A Table::Head object represents a single <THEAD></THEAD> instance for an
|
3
|
-
HTML Table.
|
4
|
-
|
5
|
-
== Notes
|
6
|
-
In virtually every respect the Table::Head class is identical to
|
7
|
-
the Table or Table::Row class. There are two significant differences.
|
8
|
-
First, the Table::Head class is a singleton. There can be only one
|
9
|
-
Table::Head instance per table. Second, if an instance of Table::Head
|
10
|
-
is added to a table, it will be automatically be put at index 0 (or 1
|
11
|
-
if a Table::Caption exists).
|
data/doc/table_row.rdoc
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
= Description
|
2
|
-
A Table::Row object represents a single <TR></TR> instance for an HTML
|
3
|
-
Table. Although it is nested under Table, it is not a subclass of Table.
|
4
|
-
It is, however, a subclass of Array.
|
5
|
-
|
6
|
-
== Synopsis
|
7
|
-
require "html/table"
|
8
|
-
include HTML
|
9
|
-
|
10
|
-
table = HTML::Table.new
|
11
|
-
|
12
|
-
row1 = Table::Row.new{ |r|
|
13
|
-
r.align = "left"
|
14
|
-
r.bgcolor = "green"
|
15
|
-
r.content = ["foo","bar","baz"]
|
16
|
-
}
|
17
|
-
|
18
|
-
row2 = Table::Row.new{ |r|
|
19
|
-
r.align = "right"
|
20
|
-
r.bgcolor = "blue"
|
21
|
-
r.content = "hello world"
|
22
|
-
}
|
23
|
-
|
24
|
-
table.push row1, row2
|
25
|
-
|
26
|
-
row1.content = "foofoo"
|
27
|
-
row1.configure(3){ |d| d.bgcolor = "pink" }
|
28
|
-
|
29
|
-
row1.push Table::Row::Header.new{ |h|
|
30
|
-
h.colspan = 2
|
31
|
-
h.content = "This is a table header"
|
32
|
-
}
|
33
|
-
|
34
|
-
row2.push Table::Row::Header.new{ |h|
|
35
|
-
h.colspan = 2
|
36
|
-
h.content = "This is also a table header"
|
37
|
-
}
|
38
|
-
|
39
|
-
puts table.html
|
40
|
-
|
41
|
-
#### output ####
|
42
|
-
<table>
|
43
|
-
<tr align='left' bgcolor='green'>
|
44
|
-
<td>foo</td>
|
45
|
-
<td>bar</td>
|
46
|
-
<td>baz</td>
|
47
|
-
<td bgcolor='pink'>foofoo</td>
|
48
|
-
<th colspan=2>This is a table header</th>
|
49
|
-
</tr>
|
50
|
-
<tr align='right' bgcolor='blue'>
|
51
|
-
<td>hello world</td>
|
52
|
-
<th colspan=2>This is also a table header</th>
|
53
|
-
</tr>
|
54
|
-
</table>
|
55
|
-
|
56
|
-
See the 'examples' directory for more examples.
|
57
|
-
|
58
|
-
== Mixins
|
59
|
-
Table::Row is a subclass of Array and therefore mixes in Enumerable. It
|
60
|
-
also mixes in Attribute_Handler.
|
61
|
-
|
62
|
-
== Class Methods
|
63
|
-
Table::Row.new(arg=nil)
|
64
|
-
Table::Row.new(arg=nil){ |t| ... }
|
65
|
-
Creates a new table. You can set attributes for the TableRow by passing
|
66
|
-
a block.
|
67
|
-
|
68
|
-
If +arg+ is supplied, it is automatically interpreted to be content.
|
69
|
-
This is a shortcut for Table::Row.new{ |r| r.content = '...' }.
|
70
|
-
|
71
|
-
== Instance Methods
|
72
|
-
Table::Row#[]=(index,obj)
|
73
|
-
Assigns +obj+ to index. The +obj+ must be a Table::Row::Header or
|
74
|
-
Table::Row::Data object, or a TypeError is raised.
|
75
|
-
|
76
|
-
Table::Row#content
|
77
|
-
Returns the HTML content of the TableRow instance, i.e. the stuff between
|
78
|
-
the <TR> and </TR> tags.
|
79
|
-
|
80
|
-
Table::Row#content=(args)
|
81
|
-
Because a Table::Row doesn't store any of its own content, the arguments
|
82
|
-
to this method must be a Table::Row::Data object, a Table::Row::Header
|
83
|
-
object, or a String (or an array of any of these). In the latter case,
|
84
|
-
a single Table::Row::Data object is created for each string.
|
85
|
-
|
86
|
-
Table::Row#html
|
87
|
-
Returns the entire HTML content of the TableRow instance.
|
88
|
-
|
89
|
-
Table::Row#push(obj)
|
90
|
-
Pushes +obj+ onto the Table::Row. The +obj+ must be a
|
91
|
-
Table::Row::Data or Table::Row::Header object, or a TypeError is
|
92
|
-
raised.
|
93
|
-
|
94
|
-
Table::Row#unshift(obj)
|
95
|
-
Unshifts +obj+ onto the Table::Row. The same rules for push apply
|
96
|
-
to unshift as well.
|
97
|
-
|
98
|
-
== Notes
|
99
|
-
String attributes are quoted. Numeric attributes are not.
|
100
|
-
|
101
|
-
Some attributes have type checking. Some check for valid arguments. In
|
102
|
-
the latter case, it is case-insensitive.
|
103
|
-
|
104
|
-
Using a non-standard extension (e.g. "background") will send a warning to
|
105
|
-
STDERR in $VERBOSE (-w) mode.
|
data/doc/table_row_data.rdoc
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
A Table::Row::Data object represents a single <TD></TD> instance for an HTML
|
3
|
-
Table. For purposes of html-table, it also represents a "column"
|
4
|
-
|
5
|
-
== Synopsis
|
6
|
-
require "html/table"
|
7
|
-
require HTML
|
8
|
-
|
9
|
-
Table::Row.end_tags = false
|
10
|
-
Table::Row::Data.end_tags = false
|
11
|
-
|
12
|
-
table = Table.new{ |t| t.border = 1 }
|
13
|
-
row = Table::Row.new
|
14
|
-
|
15
|
-
col1 = Table::Row::Data.new{ |d|
|
16
|
-
d.abbr = "test"
|
17
|
-
d.align = "right"
|
18
|
-
d.content = "hello world"
|
19
|
-
}
|
20
|
-
|
21
|
-
col2 = Table::Row::Data.new{ |d|
|
22
|
-
d.align = "center"
|
23
|
-
d.content = "Matz rules!"
|
24
|
-
}
|
25
|
-
|
26
|
-
col3 = Table::Row::Data.new{ |d|
|
27
|
-
d.align = "left"
|
28
|
-
d.content = "Foo!"
|
29
|
-
}
|
30
|
-
|
31
|
-
row.push col1, col2, col3
|
32
|
-
|
33
|
-
puts table.html
|
34
|
-
|
35
|
-
#### output ####
|
36
|
-
<table border=1>
|
37
|
-
<tr>
|
38
|
-
<td abbr='test' align='right'>hello world
|
39
|
-
<td align='center'>Matz rules!
|
40
|
-
<td align='left'>Foo!
|
41
|
-
</table>
|
42
|
-
|
43
|
-
See the 'examples' directory under 'doc' for more examples.
|
44
|
-
|
45
|
-
== Mixins
|
46
|
-
Table::Row::Data mixes in Attribute_Handler.
|
47
|
-
|
48
|
-
== Class Methods
|
49
|
-
Table::Row::Data.new(arg=nil)
|
50
|
-
Table::Row::Data.new(arg=nil){ |t| ... }
|
51
|
-
Creates a new table. You can set attributes for the Table::Row::Data by
|
52
|
-
passing a block.
|
53
|
-
|
54
|
-
If +arg+ is supplied, it is automatically interpreted to be content.
|
55
|
-
This is a shortcut for Table::Row::Data.new{ |d| d.content = '...' }.
|
56
|
-
|
57
|
-
Table::Row::Data.end_tags
|
58
|
-
Returns true or false to indicate whether end tags are included or not.
|
59
|
-
|
60
|
-
Table::Row::Data.end_tags=(bool)
|
61
|
-
Sets whether or not end tags are included in the html.
|
62
|
-
|
63
|
-
Table::Row::Data.indent_level
|
64
|
-
Returns the current number of spaces that <TD> tags are indented. The
|
65
|
-
default is 6.
|
66
|
-
|
67
|
-
Table::Row::Data.indent_level=(num)
|
68
|
-
Sets the number of spaces that <TD> tags are indented.
|
69
|
-
|
70
|
-
== Instance Methods
|
71
|
-
TableData#content
|
72
|
-
Returns the content of the TableData object, i.e. the stuff between <TD>
|
73
|
-
and </TD>.
|
74
|
-
|
75
|
-
Table::Row::Data#content=(string)
|
76
|
-
Sets the content for the TableData object, i.e. the stuff between <TD>
|
77
|
-
and </TD>.
|
78
|
-
|
79
|
-
Table::Row::Data#html
|
80
|
-
Returns all html content for the TableData instance.
|
81
|
-
|
82
|
-
== Notes
|
83
|
-
The end tags for Table::Row::Data objects are are the same line as the
|
84
|
-
begin tags.
|
85
|
-
|
86
|
-
String attributes are quoted. Numeric attributes are not.
|
87
|
-
|
88
|
-
Some attributes have type checking. Some check for valid arguments. In
|
89
|
-
the latter case, it is case-insensitive.
|
90
|
-
|
91
|
-
Using a non-standard extension (e.g. "background") will send a warning to
|
92
|
-
STDERR in $VERBOSE (-w) mode.
|
data/doc/table_row_header.rdoc
DELETED