html-table 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,9 +1,9 @@
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.
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.
@@ -1,9 +1,9 @@
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.
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.
@@ -1,8 +1,8 @@
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.
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.
@@ -1,9 +1,9 @@
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.
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.
@@ -1,15 +1,15 @@
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
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
@@ -1,8 +1,8 @@
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.
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.
@@ -1,11 +1,11 @@
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).
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).
@@ -1,105 +1,105 @@
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.
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.
@@ -1,92 +1,92 @@
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.
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.