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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +155 -149
- data/MANIFEST +59 -59
- data/README +132 -132
- data/certs/djberg96_pub.pem +15 -15
- data/doc/attributes.rdoc +143 -143
- data/doc/table.rdoc +158 -158
- data/doc/table_body.rdoc +9 -9
- data/doc/table_caption.rdoc +9 -9
- data/doc/table_colgroup.rdoc +8 -8
- data/doc/table_colgroup_col.rdoc +9 -9
- data/doc/table_content.rdoc +15 -15
- data/doc/table_foot.rdoc +8 -8
- data/doc/table_head.rdoc +11 -11
- data/doc/table_row.rdoc +105 -105
- data/doc/table_row_data.rdoc +92 -92
- data/doc/table_row_header.rdoc +7 -7
- data/examples/advanced.rb +128 -128
- data/examples/intermediate1.rb +72 -72
- data/examples/intermediate2.rb +62 -62
- data/examples/intermediate3.rb +46 -46
- data/examples/simple1.rb +39 -39
- data/examples/simple2.rb +47 -47
- data/examples/simple3.rb +41 -41
- data/html-table.gemspec +28 -28
- data/lib/html-table.rb +1 -1
- data/lib/html/attribute_handler.rb +403 -403
- data/lib/html/body.rb +37 -37
- data/lib/html/caption.rb +49 -49
- data/lib/html/col.rb +41 -41
- data/lib/html/colgroup.rb +113 -113
- data/lib/html/content.rb +18 -18
- data/lib/html/data.rb +69 -69
- data/lib/html/foot.rb +49 -49
- data/lib/html/head.rb +49 -49
- data/lib/html/header.rb +65 -65
- data/lib/html/html_handler.rb +120 -120
- data/lib/html/row.rb +188 -188
- data/lib/html/table.rb +323 -323
- data/lib/html/tablesection.rb +48 -48
- data/lib/html/tag_handler.rb +121 -121
- data/test/test_attribute_handler.rb +361 -361
- data/test/test_body.rb +87 -87
- data/test/test_caption.rb +80 -80
- data/test/test_col.rb +40 -40
- data/test/test_colgroup.rb +89 -89
- data/test/test_data.rb +77 -77
- data/test/test_foot.rb +111 -111
- data/test/test_head.rb +104 -104
- data/test/test_header.rb +77 -77
- data/test/test_html_handler.rb +37 -37
- data/test/test_row.rb +141 -141
- data/test/test_table.rb +158 -158
- data/test/test_tablesection.rb +42 -42
- data/test/test_tag_handler.rb +90 -90
- metadata +22 -22
- metadata.gz.sig +0 -0
data/examples/intermediate3.rb
CHANGED
@@ -1,46 +1,46 @@
|
|
1
|
-
#######################################################################
|
2
|
-
# intermediate3.rb
|
3
|
-
#
|
4
|
-
# This example demonstrates some intermediate features, including the
|
5
|
-
# DSL style syntax and physical tag handling.
|
6
|
-
#
|
7
|
-
# You can run this example via the "example:intermediate3" rake task.
|
8
|
-
#######################################################################
|
9
|
-
require 'html/table'
|
10
|
-
include HTML
|
11
|
-
|
12
|
-
# You can set physical tags inline using block syntax...
|
13
|
-
table = Table.new do
|
14
|
-
align 'left'
|
15
|
-
bgcolor 'red'
|
16
|
-
header [['header1', 'header2']]
|
17
|
-
content [['foo', 'bar']]
|
18
|
-
content [['baz', 'blah']] do
|
19
|
-
underline true
|
20
|
-
tt true
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# Or you can do it this way
|
25
|
-
table[1][0].content.bold = true
|
26
|
-
table[1][1].content.italic = true
|
27
|
-
|
28
|
-
puts table.html
|
29
|
-
|
30
|
-
=begin
|
31
|
-
### OUTPUT ###
|
32
|
-
<table align='left' bgcolor='red'>
|
33
|
-
<tr>
|
34
|
-
<th>header1</th>
|
35
|
-
<th>header2</th>
|
36
|
-
</tr>
|
37
|
-
<tr>
|
38
|
-
<td><b>foo</b></td>
|
39
|
-
<td><i>bar</i></td>
|
40
|
-
</tr>
|
41
|
-
<tr>
|
42
|
-
<td><tt><u>baz</u></tt></td>
|
43
|
-
<td><tt><u>blah</u></tt></td>
|
44
|
-
</tr>
|
45
|
-
</table>
|
46
|
-
=end
|
1
|
+
#######################################################################
|
2
|
+
# intermediate3.rb
|
3
|
+
#
|
4
|
+
# This example demonstrates some intermediate features, including the
|
5
|
+
# DSL style syntax and physical tag handling.
|
6
|
+
#
|
7
|
+
# You can run this example via the "example:intermediate3" rake task.
|
8
|
+
#######################################################################
|
9
|
+
require 'html/table'
|
10
|
+
include HTML
|
11
|
+
|
12
|
+
# You can set physical tags inline using block syntax...
|
13
|
+
table = Table.new do
|
14
|
+
align 'left'
|
15
|
+
bgcolor 'red'
|
16
|
+
header [['header1', 'header2']]
|
17
|
+
content [['foo', 'bar']]
|
18
|
+
content [['baz', 'blah']] do
|
19
|
+
underline true
|
20
|
+
tt true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Or you can do it this way
|
25
|
+
table[1][0].content.bold = true
|
26
|
+
table[1][1].content.italic = true
|
27
|
+
|
28
|
+
puts table.html
|
29
|
+
|
30
|
+
=begin
|
31
|
+
### OUTPUT ###
|
32
|
+
<table align='left' bgcolor='red'>
|
33
|
+
<tr>
|
34
|
+
<th>header1</th>
|
35
|
+
<th>header2</th>
|
36
|
+
</tr>
|
37
|
+
<tr>
|
38
|
+
<td><b>foo</b></td>
|
39
|
+
<td><i>bar</i></td>
|
40
|
+
</tr>
|
41
|
+
<tr>
|
42
|
+
<td><tt><u>baz</u></tt></td>
|
43
|
+
<td><tt><u>blah</u></tt></td>
|
44
|
+
</tr>
|
45
|
+
</table>
|
46
|
+
=end
|
data/examples/simple1.rb
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
#######################################################################
|
2
|
-
# simple1.rb
|
3
|
-
#
|
4
|
-
# Very plain HTML Table with rows and data implicitly created.
|
5
|
-
#
|
6
|
-
# You can run this example via the "example:sample1" rake task.
|
7
|
-
#######################################################################
|
8
|
-
require 'html/table'
|
9
|
-
include HTML
|
10
|
-
|
11
|
-
table = Table.new{ |t|
|
12
|
-
t.content = [
|
13
|
-
%w/foo bar baz/,
|
14
|
-
%w/1 2 3/,
|
15
|
-
%w/hello world/
|
16
|
-
]
|
17
|
-
}
|
18
|
-
|
19
|
-
puts table.html
|
20
|
-
|
21
|
-
=begin
|
22
|
-
### OUTPUT ###
|
23
|
-
<table>
|
24
|
-
<tr>
|
25
|
-
<td>foo</td>
|
26
|
-
<td>bar</td>
|
27
|
-
<td>baz</td>
|
28
|
-
</tr>
|
29
|
-
<tr>
|
30
|
-
<td>1</td>
|
31
|
-
<td>2</td>
|
32
|
-
<td>3</td>
|
33
|
-
</tr>
|
34
|
-
<tr>
|
35
|
-
<td>hello</td>
|
36
|
-
<td>world</td>
|
37
|
-
</tr>
|
38
|
-
</table>
|
39
|
-
=end
|
1
|
+
#######################################################################
|
2
|
+
# simple1.rb
|
3
|
+
#
|
4
|
+
# Very plain HTML Table with rows and data implicitly created.
|
5
|
+
#
|
6
|
+
# You can run this example via the "example:sample1" rake task.
|
7
|
+
#######################################################################
|
8
|
+
require 'html/table'
|
9
|
+
include HTML
|
10
|
+
|
11
|
+
table = Table.new{ |t|
|
12
|
+
t.content = [
|
13
|
+
%w/foo bar baz/,
|
14
|
+
%w/1 2 3/,
|
15
|
+
%w/hello world/
|
16
|
+
]
|
17
|
+
}
|
18
|
+
|
19
|
+
puts table.html
|
20
|
+
|
21
|
+
=begin
|
22
|
+
### OUTPUT ###
|
23
|
+
<table>
|
24
|
+
<tr>
|
25
|
+
<td>foo</td>
|
26
|
+
<td>bar</td>
|
27
|
+
<td>baz</td>
|
28
|
+
</tr>
|
29
|
+
<tr>
|
30
|
+
<td>1</td>
|
31
|
+
<td>2</td>
|
32
|
+
<td>3</td>
|
33
|
+
</tr>
|
34
|
+
<tr>
|
35
|
+
<td>hello</td>
|
36
|
+
<td>world</td>
|
37
|
+
</tr>
|
38
|
+
</table>
|
39
|
+
=end
|
data/examples/simple2.rb
CHANGED
@@ -1,47 +1,47 @@
|
|
1
|
-
#######################################################################
|
2
|
-
# simple2.rb
|
3
|
-
#
|
4
|
-
# Very plain HTML Table with rows explicitly created and data
|
5
|
-
# elements implicitly created. We also remove the end tags
|
6
|
-
# and capitalize the HTML tags and attributes.
|
7
|
-
#
|
8
|
-
# You can run this sample via the "example:simple2" rake task.
|
9
|
-
#######################################################################
|
10
|
-
require 'html/table'
|
11
|
-
include HTML
|
12
|
-
|
13
|
-
Table.html_case = "upper"
|
14
|
-
Table::Row.end_tags = false
|
15
|
-
Table::Row::Data.end_tags = false
|
16
|
-
|
17
|
-
table = Table.new
|
18
|
-
tr1 = Table::Row.new
|
19
|
-
tr2 = Table::Row.new
|
20
|
-
tr3 = Table::Row.new
|
21
|
-
|
22
|
-
tr1.content = "foo", "bar", "baz"
|
23
|
-
tr2.content = 1,2,3
|
24
|
-
tr3.content = %w/hello world/
|
25
|
-
|
26
|
-
table.push(tr1,tr2,tr3)
|
27
|
-
|
28
|
-
table[0][1].align = "left"
|
29
|
-
|
30
|
-
puts table.html
|
31
|
-
|
32
|
-
=begin
|
33
|
-
### OUTPUT ###
|
34
|
-
<TABLE>
|
35
|
-
<TR>
|
36
|
-
<TD>foo
|
37
|
-
<TD ALIGN='LEFT'>bar
|
38
|
-
<TD>baz
|
39
|
-
<TR>
|
40
|
-
<TD>1
|
41
|
-
<TD>2
|
42
|
-
<TD>3
|
43
|
-
<TR>
|
44
|
-
<TD>hello
|
45
|
-
<TD>world
|
46
|
-
</TABLE>
|
47
|
-
=end
|
1
|
+
#######################################################################
|
2
|
+
# simple2.rb
|
3
|
+
#
|
4
|
+
# Very plain HTML Table with rows explicitly created and data
|
5
|
+
# elements implicitly created. We also remove the end tags
|
6
|
+
# and capitalize the HTML tags and attributes.
|
7
|
+
#
|
8
|
+
# You can run this sample via the "example:simple2" rake task.
|
9
|
+
#######################################################################
|
10
|
+
require 'html/table'
|
11
|
+
include HTML
|
12
|
+
|
13
|
+
Table.html_case = "upper"
|
14
|
+
Table::Row.end_tags = false
|
15
|
+
Table::Row::Data.end_tags = false
|
16
|
+
|
17
|
+
table = Table.new
|
18
|
+
tr1 = Table::Row.new
|
19
|
+
tr2 = Table::Row.new
|
20
|
+
tr3 = Table::Row.new
|
21
|
+
|
22
|
+
tr1.content = "foo", "bar", "baz"
|
23
|
+
tr2.content = 1,2,3
|
24
|
+
tr3.content = %w/hello world/
|
25
|
+
|
26
|
+
table.push(tr1,tr2,tr3)
|
27
|
+
|
28
|
+
table[0][1].align = "left"
|
29
|
+
|
30
|
+
puts table.html
|
31
|
+
|
32
|
+
=begin
|
33
|
+
### OUTPUT ###
|
34
|
+
<TABLE>
|
35
|
+
<TR>
|
36
|
+
<TD>foo
|
37
|
+
<TD ALIGN='LEFT'>bar
|
38
|
+
<TD>baz
|
39
|
+
<TR>
|
40
|
+
<TD>1
|
41
|
+
<TD>2
|
42
|
+
<TD>3
|
43
|
+
<TR>
|
44
|
+
<TD>hello
|
45
|
+
<TD>world
|
46
|
+
</TABLE>
|
47
|
+
=end
|
data/examples/simple3.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
#######################################################################
|
2
|
-
# simple3.rb
|
3
|
-
#
|
4
|
-
# Very plain HTML Table with rows and data implicitly created. This
|
5
|
-
# script passes an argument to the constructor, which is automatically
|
6
|
-
# interpreted as content.
|
7
|
-
#
|
8
|
-
# You can run this script via the "example:simple3" rake task.
|
9
|
-
#######################################################################
|
10
|
-
require 'html/table'
|
11
|
-
include HTML
|
12
|
-
|
13
|
-
m = [
|
14
|
-
['foo', 'bar', 'baz'],
|
15
|
-
[1, 2, 3],
|
16
|
-
['hello', 'world']
|
17
|
-
]
|
18
|
-
|
19
|
-
table = Table.new(m)
|
20
|
-
|
21
|
-
puts table.html
|
22
|
-
|
23
|
-
=begin
|
24
|
-
### OUTPUT ###
|
25
|
-
<table>
|
26
|
-
<tr>
|
27
|
-
<td>foo</td>
|
28
|
-
<td>bar</td>
|
29
|
-
<td>baz</td>
|
30
|
-
</tr>
|
31
|
-
<tr>
|
32
|
-
<td>1</td>
|
33
|
-
<td>2</td>
|
34
|
-
<td>3</td>
|
35
|
-
</tr>
|
36
|
-
<tr>
|
37
|
-
<td>hello</td>
|
38
|
-
<td>world</td>
|
39
|
-
</tr>
|
40
|
-
</table>
|
41
|
-
=end
|
1
|
+
#######################################################################
|
2
|
+
# simple3.rb
|
3
|
+
#
|
4
|
+
# Very plain HTML Table with rows and data implicitly created. This
|
5
|
+
# script passes an argument to the constructor, which is automatically
|
6
|
+
# interpreted as content.
|
7
|
+
#
|
8
|
+
# You can run this script via the "example:simple3" rake task.
|
9
|
+
#######################################################################
|
10
|
+
require 'html/table'
|
11
|
+
include HTML
|
12
|
+
|
13
|
+
m = [
|
14
|
+
['foo', 'bar', 'baz'],
|
15
|
+
[1, 2, 3],
|
16
|
+
['hello', 'world']
|
17
|
+
]
|
18
|
+
|
19
|
+
table = Table.new(m)
|
20
|
+
|
21
|
+
puts table.html
|
22
|
+
|
23
|
+
=begin
|
24
|
+
### OUTPUT ###
|
25
|
+
<table>
|
26
|
+
<tr>
|
27
|
+
<td>foo</td>
|
28
|
+
<td>bar</td>
|
29
|
+
<td>baz</td>
|
30
|
+
</tr>
|
31
|
+
<tr>
|
32
|
+
<td>1</td>
|
33
|
+
<td>2</td>
|
34
|
+
<td>3</td>
|
35
|
+
</tr>
|
36
|
+
<tr>
|
37
|
+
<td>hello</td>
|
38
|
+
<td>world</td>
|
39
|
+
</tr>
|
40
|
+
</table>
|
41
|
+
=end
|
data/html-table.gemspec
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'html-table'
|
5
|
-
spec.version = '1.
|
6
|
-
spec.author = 'Daniel J. Berger'
|
7
|
-
spec.license = 'Artistic 2.0'
|
8
|
-
spec.email = 'djberg96@gmail.com'
|
9
|
-
spec.homepage = 'http://github.com/djberg96/html-table'
|
10
|
-
spec.summary = 'A Ruby interface for generating HTML tables'
|
11
|
-
spec.test_files = Dir['test/*.rb']
|
12
|
-
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
|
-
spec.cert_chain = ['certs/djberg96_pub.pem']
|
14
|
-
|
15
|
-
spec.extra_rdoc_files = ['README', 'CHANGES'] + Dir['doc/*.rdoc']
|
16
|
-
|
17
|
-
spec.add_dependency('strongtyping')
|
18
|
-
spec.add_dependency('structured_warnings')
|
19
|
-
|
20
|
-
spec.add_development_dependency('test-unit')
|
21
|
-
spec.add_development_dependency('rake')
|
22
|
-
|
23
|
-
spec.description = <<-EOF
|
24
|
-
The html-table library provides an interface for generating HTML tables
|
25
|
-
in a syntax comfortable to Ruby programmers, but with some enforcement
|
26
|
-
of where certain elements can be placed.
|
27
|
-
EOF
|
28
|
-
end
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'html-table'
|
5
|
+
spec.version = '1.5.0'
|
6
|
+
spec.author = 'Daniel J. Berger'
|
7
|
+
spec.license = 'Artistic 2.0'
|
8
|
+
spec.email = 'djberg96@gmail.com'
|
9
|
+
spec.homepage = 'http://github.com/djberg96/html-table'
|
10
|
+
spec.summary = 'A Ruby interface for generating HTML tables'
|
11
|
+
spec.test_files = Dir['test/*.rb']
|
12
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
|
+
spec.cert_chain = ['certs/djberg96_pub.pem']
|
14
|
+
|
15
|
+
spec.extra_rdoc_files = ['README', 'CHANGES'] + Dir['doc/*.rdoc']
|
16
|
+
|
17
|
+
spec.add_dependency('strongtyping')
|
18
|
+
spec.add_dependency('structured_warnings', '~> 0.3.0')
|
19
|
+
|
20
|
+
spec.add_development_dependency('test-unit')
|
21
|
+
spec.add_development_dependency('rake')
|
22
|
+
|
23
|
+
spec.description = <<-EOF
|
24
|
+
The html-table library provides an interface for generating HTML tables
|
25
|
+
in a syntax comfortable to Ruby programmers, but with some enforcement
|
26
|
+
of where certain elements can be placed.
|
27
|
+
EOF
|
28
|
+
end
|
data/lib/html-table.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require_relative 'html/table'
|
1
|
+
require_relative 'html/table'
|
@@ -1,403 +1,403 @@
|
|
1
|
-
# This module creates methods for each of the various attributes associated
|
2
|
-
# with HTML tables. In some cases validation is done on the setters.
|
3
|
-
#--
|
4
|
-
# The seemingly redundant writer methods were left here for backwards
|
5
|
-
# compatibility and for those who may not prefer the DSI.
|
6
|
-
#
|
7
|
-
module AttributeHandler
|
8
|
-
def abbr(string = nil)
|
9
|
-
@abbr ||= nil
|
10
|
-
self.abbr = string if string
|
11
|
-
@abbr
|
12
|
-
end
|
13
|
-
|
14
|
-
def abbr=(string)
|
15
|
-
@abbr = string
|
16
|
-
modify_html("abbr", string)
|
17
|
-
end
|
18
|
-
|
19
|
-
def align(position = nil)
|
20
|
-
@align ||= nil
|
21
|
-
self.align = position if position
|
22
|
-
@align
|
23
|
-
end
|
24
|
-
|
25
|
-
def align=(position)
|
26
|
-
valid = %w/top bottom left center right/
|
27
|
-
raise ArgumentError unless valid.include?(position.downcase)
|
28
|
-
@align = position
|
29
|
-
modify_html("align", position)
|
30
|
-
end
|
31
|
-
|
32
|
-
def axis(string = nil)
|
33
|
-
@axis ||= nil
|
34
|
-
self.axis = string if string
|
35
|
-
@axis
|
36
|
-
end
|
37
|
-
|
38
|
-
def axis=(string)
|
39
|
-
@axis = string
|
40
|
-
modify_html("axis", string)
|
41
|
-
end
|
42
|
-
|
43
|
-
def background(url = nil)
|
44
|
-
@background ||= nil
|
45
|
-
self.background = url if url
|
46
|
-
@background
|
47
|
-
end
|
48
|
-
|
49
|
-
def background=(url)
|
50
|
-
raise TypeError unless url.kind_of?(String)
|
51
|
-
msg = "'background' is a non-standard extension"
|
52
|
-
warn NonStandardExtensionWarning, msg
|
53
|
-
@background = url
|
54
|
-
modify_html("background", url)
|
55
|
-
end
|
56
|
-
|
57
|
-
def bgcolor(color = nil)
|
58
|
-
@bgcolor ||= nil
|
59
|
-
self.bgcolor = color if color
|
60
|
-
@bgcolor
|
61
|
-
end
|
62
|
-
|
63
|
-
def bgcolor=(color)
|
64
|
-
@bgcolor = color
|
65
|
-
modify_html("bgcolor", color)
|
66
|
-
end
|
67
|
-
|
68
|
-
def border(num = nil)
|
69
|
-
@border ||= nil
|
70
|
-
self.border = num if num
|
71
|
-
@border
|
72
|
-
end
|
73
|
-
|
74
|
-
# Allow either true/false or an integer
|
75
|
-
def border=(num)
|
76
|
-
if num.kind_of?(TrueClass)
|
77
|
-
modify_html("border", true)
|
78
|
-
elsif num.kind_of?(FalseClass)
|
79
|
-
# Do nothing
|
80
|
-
else
|
81
|
-
@border = num.to_i
|
82
|
-
modify_html("border", num.to_i)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def bordercolor(color = nil)
|
87
|
-
@bordercolor ||= nil
|
88
|
-
self.bordercolor = color if color
|
89
|
-
@bordercolor
|
90
|
-
end
|
91
|
-
|
92
|
-
def bordercolor=(color)
|
93
|
-
@bordercolor = color
|
94
|
-
msg = "'bordercolor' is a non-standard extension"
|
95
|
-
warn NonStandardExtensionWarning, msg
|
96
|
-
modify_html("bordercolor", color)
|
97
|
-
end
|
98
|
-
|
99
|
-
def bordercolordark(color = nil)
|
100
|
-
@bordercolordark ||= nil
|
101
|
-
self.bordercolordark = color if color
|
102
|
-
@bordercolordark
|
103
|
-
end
|
104
|
-
|
105
|
-
def bordercolordark=(color)
|
106
|
-
@bordercolordark = color
|
107
|
-
msg = "'bordercolordark' is a non-standard extension"
|
108
|
-
warn NonStandardExtensionWarning, msg
|
109
|
-
modify_html("bordercolordark", color)
|
110
|
-
end
|
111
|
-
|
112
|
-
def bordercolorlight(color = nil)
|
113
|
-
@bordercolorlight ||= nil
|
114
|
-
self.bordercolorlight = color if color
|
115
|
-
@bordercolorlight
|
116
|
-
end
|
117
|
-
|
118
|
-
def bordercolorlight=(color)
|
119
|
-
@bordercolorlight = color
|
120
|
-
msg = "'bordercolorlight' is a non-standard extension"
|
121
|
-
warn NonStandardExtensionWarning, msg
|
122
|
-
modify_html("bordercolorlight", @bordercolorlight)
|
123
|
-
end
|
124
|
-
|
125
|
-
def cellpadding(num = nil)
|
126
|
-
@cellpadding ||= nil
|
127
|
-
self.cellpadding = num if num
|
128
|
-
@cellpadding
|
129
|
-
end
|
130
|
-
|
131
|
-
def cellpadding=(num)
|
132
|
-
raise ArgumentError if num.to_i < 0
|
133
|
-
@cellpadding = num.to_i
|
134
|
-
modify_html("cellpadding", @cellpadding)
|
135
|
-
end
|
136
|
-
|
137
|
-
def cellspacing(num = nil)
|
138
|
-
@cellspacing ||= nil
|
139
|
-
self.cellspacing = num if num
|
140
|
-
@cellspacing
|
141
|
-
end
|
142
|
-
|
143
|
-
def cellspacing=(num)
|
144
|
-
raise ArgumentError if num.to_i < 0
|
145
|
-
@cellspacing = num.to_i
|
146
|
-
modify_html("cellspacing", @cellspacing)
|
147
|
-
end
|
148
|
-
|
149
|
-
def char(character = nil)
|
150
|
-
@char ||= nil
|
151
|
-
self.char = character if character
|
152
|
-
@char
|
153
|
-
end
|
154
|
-
|
155
|
-
def char=(character)
|
156
|
-
raise ArgumentError if character.to_s.length > 1
|
157
|
-
@char = character.to_s
|
158
|
-
modify_html("char", character.to_s)
|
159
|
-
end
|
160
|
-
|
161
|
-
def charoff(offset = nil)
|
162
|
-
@charoff ||= nil
|
163
|
-
self.charoff = offset if offset
|
164
|
-
@charoff
|
165
|
-
end
|
166
|
-
|
167
|
-
def charoff=(offset)
|
168
|
-
raise ArgumentError if offset.to_i < 0
|
169
|
-
@charoff = offset
|
170
|
-
modify_html("charoff", offset)
|
171
|
-
end
|
172
|
-
|
173
|
-
# Returns the CSS class. The trailing underscore is necessary in order
|
174
|
-
# to avoid conflict with the 'class' keyword.
|
175
|
-
#
|
176
|
-
def class_(klass = nil)
|
177
|
-
@class ||= nil
|
178
|
-
self.class_ = klass if klass
|
179
|
-
@class
|
180
|
-
end
|
181
|
-
|
182
|
-
# Returns the CSS class. The trailing underscore is necessary in order
|
183
|
-
# to avoid conflict with the 'class' keyword.
|
184
|
-
#
|
185
|
-
def class_=(klass)
|
186
|
-
modify_html('class', klass)
|
187
|
-
@class = klass
|
188
|
-
end
|
189
|
-
|
190
|
-
def col(num = nil)
|
191
|
-
@col ||= nil
|
192
|
-
self.col = num if num
|
193
|
-
@col
|
194
|
-
end
|
195
|
-
|
196
|
-
def col=(num)
|
197
|
-
raise ArgumentError if num.to_i < 0
|
198
|
-
@col = num.to_i
|
199
|
-
modify_html("col", @col)
|
200
|
-
end
|
201
|
-
|
202
|
-
def colspan(span = nil)
|
203
|
-
@colspan ||= nil
|
204
|
-
self.colspan = span if span
|
205
|
-
@colspan
|
206
|
-
end
|
207
|
-
|
208
|
-
def colspan=(span)
|
209
|
-
raise ArgumentError if span.to_i < 0
|
210
|
-
@colspan = span.to_i
|
211
|
-
modify_html("colspan", @colspan)
|
212
|
-
end
|
213
|
-
|
214
|
-
# Allows you to configure various attributes by row or row + column.
|
215
|
-
#
|
216
|
-
def configure(row, col=nil, &block)
|
217
|
-
if col
|
218
|
-
begin
|
219
|
-
yield self[row][col]
|
220
|
-
rescue NameError
|
221
|
-
msg = "No column to configure in a " + self.class.to_s + " class"
|
222
|
-
raise ArgumentError, msg
|
223
|
-
end
|
224
|
-
else
|
225
|
-
yield self[row]
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
# Returns the HTML content (i.e. text).
|
230
|
-
#
|
231
|
-
def content(arg = nil, &block)
|
232
|
-
case arg
|
233
|
-
when String
|
234
|
-
self.content = Table::Content.new(arg, &block)
|
235
|
-
when Array
|
236
|
-
arg.each{ |e|
|
237
|
-
if e.kind_of?(Array)
|
238
|
-
row = Table::Row.new
|
239
|
-
e.each{ |element| row.push(Table::Content.new(element, &block)) }
|
240
|
-
self.push(row)
|
241
|
-
else
|
242
|
-
self.content = Table::Content.new(e, &block)
|
243
|
-
end
|
244
|
-
}
|
245
|
-
else
|
246
|
-
self.content = arg if arg
|
247
|
-
end
|
248
|
-
@html_body
|
249
|
-
end
|
250
|
-
|
251
|
-
alias data content
|
252
|
-
|
253
|
-
def frame(type = nil)
|
254
|
-
@frame ||= nil
|
255
|
-
self.frame = type if type
|
256
|
-
@frame
|
257
|
-
end
|
258
|
-
|
259
|
-
def frame=(type)
|
260
|
-
valid = %w/border void above below hsides lhs rhs vsides box/
|
261
|
-
raise ArgumentError unless valid.include?(type.downcase)
|
262
|
-
@frame = type
|
263
|
-
modify_html("frame", @frame)
|
264
|
-
end
|
265
|
-
|
266
|
-
def height(num = nil)
|
267
|
-
@height ||= nil
|
268
|
-
self.height = num if num
|
269
|
-
@height
|
270
|
-
end
|
271
|
-
|
272
|
-
def height=(num)
|
273
|
-
raise ArgumentError if num.to_i < 0
|
274
|
-
@height = num.to_i
|
275
|
-
modify_html("height", @height)
|
276
|
-
end
|
277
|
-
|
278
|
-
def hspace(num = nil)
|
279
|
-
@hspace ||= nil
|
280
|
-
self.hspace = num if num
|
281
|
-
@hspace
|
282
|
-
end
|
283
|
-
|
284
|
-
def hspace=(num)
|
285
|
-
raise ArgumentError if num.to_i < 0
|
286
|
-
@hspace = num.to_i
|
287
|
-
modify_html("hspace", @hspace)
|
288
|
-
end
|
289
|
-
|
290
|
-
def nowrap(bool = nil)
|
291
|
-
@nowrap ||= nil
|
292
|
-
self.nowrap = bool if bool
|
293
|
-
@nowrap
|
294
|
-
end
|
295
|
-
|
296
|
-
def nowrap=(bool)
|
297
|
-
unless bool.kind_of?(TrueClass) || bool.kind_of?(FalseClass)
|
298
|
-
raise TypeError
|
299
|
-
end
|
300
|
-
@nowrap = bool
|
301
|
-
modify_html("nowrap", @nowrap)
|
302
|
-
end
|
303
|
-
|
304
|
-
def rowspan(num = nil)
|
305
|
-
@rowspan ||= nil
|
306
|
-
self.rowspan = num if num
|
307
|
-
@rowspan
|
308
|
-
end
|
309
|
-
|
310
|
-
def rowspan=(num)
|
311
|
-
raise ArgumentError if num.to_i < 0
|
312
|
-
@rowspan = num.to_i
|
313
|
-
modify_html("rowspan", @rowspan)
|
314
|
-
end
|
315
|
-
|
316
|
-
def rules(edges = nil)
|
317
|
-
@rules ||= nil
|
318
|
-
self.rules = edges if edges
|
319
|
-
@rules
|
320
|
-
end
|
321
|
-
|
322
|
-
def rules=(edges)
|
323
|
-
valid = %w/all groups rows cols none/
|
324
|
-
raise ArgumentError unless valid.include?(edges.to_s.downcase)
|
325
|
-
@rules = edges
|
326
|
-
modify_html("rules", @rules)
|
327
|
-
end
|
328
|
-
|
329
|
-
def span(num = nil)
|
330
|
-
@span ||= nil
|
331
|
-
self.span = num if num
|
332
|
-
@span
|
333
|
-
end
|
334
|
-
|
335
|
-
def span=(num)
|
336
|
-
raise ArgumentError if num.to_i < 0
|
337
|
-
@span = num.to_i
|
338
|
-
modify_html("span", @span)
|
339
|
-
end
|
340
|
-
|
341
|
-
def style(string = nil)
|
342
|
-
@style ||= nil
|
343
|
-
self.style = string if string
|
344
|
-
@style
|
345
|
-
end
|
346
|
-
|
347
|
-
def style=(string)
|
348
|
-
@style = string.to_s
|
349
|
-
modify_html("style", @style)
|
350
|
-
end
|
351
|
-
|
352
|
-
def summary(string = nil)
|
353
|
-
@summary ||= nil
|
354
|
-
self.summary = string if string
|
355
|
-
@summary
|
356
|
-
end
|
357
|
-
|
358
|
-
def summary=(string)
|
359
|
-
@summary = string.to_s
|
360
|
-
modify_html("summary", @summary)
|
361
|
-
end
|
362
|
-
|
363
|
-
def valign(position = nil)
|
364
|
-
@valign ||= nil
|
365
|
-
self.valign = position if position
|
366
|
-
@valign
|
367
|
-
end
|
368
|
-
|
369
|
-
def valign=(position)
|
370
|
-
valid = %w/top center bottom baseline/
|
371
|
-
raise ArgumentError unless valid.include?(position.to_s.downcase)
|
372
|
-
@valign = position
|
373
|
-
modify_html("valign", @valign)
|
374
|
-
end
|
375
|
-
|
376
|
-
def vspace(num = nil)
|
377
|
-
@vspace ||= nil
|
378
|
-
self.vspace = num if num
|
379
|
-
@vspace
|
380
|
-
end
|
381
|
-
|
382
|
-
def vspace=(num)
|
383
|
-
raise ArgumentError if num.to_i < 0
|
384
|
-
@vspace = num.to_i
|
385
|
-
modify_html("vspace", @vspace)
|
386
|
-
end
|
387
|
-
|
388
|
-
def width(num = nil)
|
389
|
-
@width ||= nil
|
390
|
-
self.width = num if num
|
391
|
-
@width
|
392
|
-
end
|
393
|
-
|
394
|
-
def width=(num)
|
395
|
-
if num =~ /%/
|
396
|
-
@width = num
|
397
|
-
else
|
398
|
-
raise ArgumentError if num.to_i < 0
|
399
|
-
@width = num.to_i
|
400
|
-
end
|
401
|
-
modify_html("width", @width)
|
402
|
-
end
|
403
|
-
end
|
1
|
+
# This module creates methods for each of the various attributes associated
|
2
|
+
# with HTML tables. In some cases validation is done on the setters.
|
3
|
+
#--
|
4
|
+
# The seemingly redundant writer methods were left here for backwards
|
5
|
+
# compatibility and for those who may not prefer the DSI.
|
6
|
+
#
|
7
|
+
module AttributeHandler
|
8
|
+
def abbr(string = nil)
|
9
|
+
@abbr ||= nil
|
10
|
+
self.abbr = string if string
|
11
|
+
@abbr
|
12
|
+
end
|
13
|
+
|
14
|
+
def abbr=(string)
|
15
|
+
@abbr = string
|
16
|
+
modify_html("abbr", string)
|
17
|
+
end
|
18
|
+
|
19
|
+
def align(position = nil)
|
20
|
+
@align ||= nil
|
21
|
+
self.align = position if position
|
22
|
+
@align
|
23
|
+
end
|
24
|
+
|
25
|
+
def align=(position)
|
26
|
+
valid = %w/top bottom left center right/
|
27
|
+
raise ArgumentError unless valid.include?(position.downcase)
|
28
|
+
@align = position
|
29
|
+
modify_html("align", position)
|
30
|
+
end
|
31
|
+
|
32
|
+
def axis(string = nil)
|
33
|
+
@axis ||= nil
|
34
|
+
self.axis = string if string
|
35
|
+
@axis
|
36
|
+
end
|
37
|
+
|
38
|
+
def axis=(string)
|
39
|
+
@axis = string
|
40
|
+
modify_html("axis", string)
|
41
|
+
end
|
42
|
+
|
43
|
+
def background(url = nil)
|
44
|
+
@background ||= nil
|
45
|
+
self.background = url if url
|
46
|
+
@background
|
47
|
+
end
|
48
|
+
|
49
|
+
def background=(url)
|
50
|
+
raise TypeError unless url.kind_of?(String)
|
51
|
+
msg = "'background' is a non-standard extension"
|
52
|
+
warn NonStandardExtensionWarning, msg
|
53
|
+
@background = url
|
54
|
+
modify_html("background", url)
|
55
|
+
end
|
56
|
+
|
57
|
+
def bgcolor(color = nil)
|
58
|
+
@bgcolor ||= nil
|
59
|
+
self.bgcolor = color if color
|
60
|
+
@bgcolor
|
61
|
+
end
|
62
|
+
|
63
|
+
def bgcolor=(color)
|
64
|
+
@bgcolor = color
|
65
|
+
modify_html("bgcolor", color)
|
66
|
+
end
|
67
|
+
|
68
|
+
def border(num = nil)
|
69
|
+
@border ||= nil
|
70
|
+
self.border = num if num
|
71
|
+
@border
|
72
|
+
end
|
73
|
+
|
74
|
+
# Allow either true/false or an integer
|
75
|
+
def border=(num)
|
76
|
+
if num.kind_of?(TrueClass)
|
77
|
+
modify_html("border", true)
|
78
|
+
elsif num.kind_of?(FalseClass)
|
79
|
+
# Do nothing
|
80
|
+
else
|
81
|
+
@border = num.to_i
|
82
|
+
modify_html("border", num.to_i)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def bordercolor(color = nil)
|
87
|
+
@bordercolor ||= nil
|
88
|
+
self.bordercolor = color if color
|
89
|
+
@bordercolor
|
90
|
+
end
|
91
|
+
|
92
|
+
def bordercolor=(color)
|
93
|
+
@bordercolor = color
|
94
|
+
msg = "'bordercolor' is a non-standard extension"
|
95
|
+
warn NonStandardExtensionWarning, msg
|
96
|
+
modify_html("bordercolor", color)
|
97
|
+
end
|
98
|
+
|
99
|
+
def bordercolordark(color = nil)
|
100
|
+
@bordercolordark ||= nil
|
101
|
+
self.bordercolordark = color if color
|
102
|
+
@bordercolordark
|
103
|
+
end
|
104
|
+
|
105
|
+
def bordercolordark=(color)
|
106
|
+
@bordercolordark = color
|
107
|
+
msg = "'bordercolordark' is a non-standard extension"
|
108
|
+
warn NonStandardExtensionWarning, msg
|
109
|
+
modify_html("bordercolordark", color)
|
110
|
+
end
|
111
|
+
|
112
|
+
def bordercolorlight(color = nil)
|
113
|
+
@bordercolorlight ||= nil
|
114
|
+
self.bordercolorlight = color if color
|
115
|
+
@bordercolorlight
|
116
|
+
end
|
117
|
+
|
118
|
+
def bordercolorlight=(color)
|
119
|
+
@bordercolorlight = color
|
120
|
+
msg = "'bordercolorlight' is a non-standard extension"
|
121
|
+
warn NonStandardExtensionWarning, msg
|
122
|
+
modify_html("bordercolorlight", @bordercolorlight)
|
123
|
+
end
|
124
|
+
|
125
|
+
def cellpadding(num = nil)
|
126
|
+
@cellpadding ||= nil
|
127
|
+
self.cellpadding = num if num
|
128
|
+
@cellpadding
|
129
|
+
end
|
130
|
+
|
131
|
+
def cellpadding=(num)
|
132
|
+
raise ArgumentError if num.to_i < 0
|
133
|
+
@cellpadding = num.to_i
|
134
|
+
modify_html("cellpadding", @cellpadding)
|
135
|
+
end
|
136
|
+
|
137
|
+
def cellspacing(num = nil)
|
138
|
+
@cellspacing ||= nil
|
139
|
+
self.cellspacing = num if num
|
140
|
+
@cellspacing
|
141
|
+
end
|
142
|
+
|
143
|
+
def cellspacing=(num)
|
144
|
+
raise ArgumentError if num.to_i < 0
|
145
|
+
@cellspacing = num.to_i
|
146
|
+
modify_html("cellspacing", @cellspacing)
|
147
|
+
end
|
148
|
+
|
149
|
+
def char(character = nil)
|
150
|
+
@char ||= nil
|
151
|
+
self.char = character if character
|
152
|
+
@char
|
153
|
+
end
|
154
|
+
|
155
|
+
def char=(character)
|
156
|
+
raise ArgumentError if character.to_s.length > 1
|
157
|
+
@char = character.to_s
|
158
|
+
modify_html("char", character.to_s)
|
159
|
+
end
|
160
|
+
|
161
|
+
def charoff(offset = nil)
|
162
|
+
@charoff ||= nil
|
163
|
+
self.charoff = offset if offset
|
164
|
+
@charoff
|
165
|
+
end
|
166
|
+
|
167
|
+
def charoff=(offset)
|
168
|
+
raise ArgumentError if offset.to_i < 0
|
169
|
+
@charoff = offset
|
170
|
+
modify_html("charoff", offset)
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the CSS class. The trailing underscore is necessary in order
|
174
|
+
# to avoid conflict with the 'class' keyword.
|
175
|
+
#
|
176
|
+
def class_(klass = nil)
|
177
|
+
@class ||= nil
|
178
|
+
self.class_ = klass if klass
|
179
|
+
@class
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the CSS class. The trailing underscore is necessary in order
|
183
|
+
# to avoid conflict with the 'class' keyword.
|
184
|
+
#
|
185
|
+
def class_=(klass)
|
186
|
+
modify_html('class', klass)
|
187
|
+
@class = klass
|
188
|
+
end
|
189
|
+
|
190
|
+
def col(num = nil)
|
191
|
+
@col ||= nil
|
192
|
+
self.col = num if num
|
193
|
+
@col
|
194
|
+
end
|
195
|
+
|
196
|
+
def col=(num)
|
197
|
+
raise ArgumentError if num.to_i < 0
|
198
|
+
@col = num.to_i
|
199
|
+
modify_html("col", @col)
|
200
|
+
end
|
201
|
+
|
202
|
+
def colspan(span = nil)
|
203
|
+
@colspan ||= nil
|
204
|
+
self.colspan = span if span
|
205
|
+
@colspan
|
206
|
+
end
|
207
|
+
|
208
|
+
def colspan=(span)
|
209
|
+
raise ArgumentError if span.to_i < 0
|
210
|
+
@colspan = span.to_i
|
211
|
+
modify_html("colspan", @colspan)
|
212
|
+
end
|
213
|
+
|
214
|
+
# Allows you to configure various attributes by row or row + column.
|
215
|
+
#
|
216
|
+
def configure(row, col=nil, &block)
|
217
|
+
if col
|
218
|
+
begin
|
219
|
+
yield self[row][col]
|
220
|
+
rescue NameError
|
221
|
+
msg = "No column to configure in a " + self.class.to_s + " class"
|
222
|
+
raise ArgumentError, msg
|
223
|
+
end
|
224
|
+
else
|
225
|
+
yield self[row]
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
# Returns the HTML content (i.e. text).
|
230
|
+
#
|
231
|
+
def content(arg = nil, &block)
|
232
|
+
case arg
|
233
|
+
when String
|
234
|
+
self.content = Table::Content.new(arg, &block)
|
235
|
+
when Array
|
236
|
+
arg.each{ |e|
|
237
|
+
if e.kind_of?(Array)
|
238
|
+
row = Table::Row.new
|
239
|
+
e.each{ |element| row.push(Table::Content.new(element, &block)) }
|
240
|
+
self.push(row)
|
241
|
+
else
|
242
|
+
self.content = Table::Content.new(e, &block)
|
243
|
+
end
|
244
|
+
}
|
245
|
+
else
|
246
|
+
self.content = arg if arg
|
247
|
+
end
|
248
|
+
@html_body
|
249
|
+
end
|
250
|
+
|
251
|
+
alias data content
|
252
|
+
|
253
|
+
def frame(type = nil)
|
254
|
+
@frame ||= nil
|
255
|
+
self.frame = type if type
|
256
|
+
@frame
|
257
|
+
end
|
258
|
+
|
259
|
+
def frame=(type)
|
260
|
+
valid = %w/border void above below hsides lhs rhs vsides box/
|
261
|
+
raise ArgumentError unless valid.include?(type.downcase)
|
262
|
+
@frame = type
|
263
|
+
modify_html("frame", @frame)
|
264
|
+
end
|
265
|
+
|
266
|
+
def height(num = nil)
|
267
|
+
@height ||= nil
|
268
|
+
self.height = num if num
|
269
|
+
@height
|
270
|
+
end
|
271
|
+
|
272
|
+
def height=(num)
|
273
|
+
raise ArgumentError if num.to_i < 0
|
274
|
+
@height = num.to_i
|
275
|
+
modify_html("height", @height)
|
276
|
+
end
|
277
|
+
|
278
|
+
def hspace(num = nil)
|
279
|
+
@hspace ||= nil
|
280
|
+
self.hspace = num if num
|
281
|
+
@hspace
|
282
|
+
end
|
283
|
+
|
284
|
+
def hspace=(num)
|
285
|
+
raise ArgumentError if num.to_i < 0
|
286
|
+
@hspace = num.to_i
|
287
|
+
modify_html("hspace", @hspace)
|
288
|
+
end
|
289
|
+
|
290
|
+
def nowrap(bool = nil)
|
291
|
+
@nowrap ||= nil
|
292
|
+
self.nowrap = bool if bool
|
293
|
+
@nowrap
|
294
|
+
end
|
295
|
+
|
296
|
+
def nowrap=(bool)
|
297
|
+
unless bool.kind_of?(TrueClass) || bool.kind_of?(FalseClass)
|
298
|
+
raise TypeError
|
299
|
+
end
|
300
|
+
@nowrap = bool
|
301
|
+
modify_html("nowrap", @nowrap)
|
302
|
+
end
|
303
|
+
|
304
|
+
def rowspan(num = nil)
|
305
|
+
@rowspan ||= nil
|
306
|
+
self.rowspan = num if num
|
307
|
+
@rowspan
|
308
|
+
end
|
309
|
+
|
310
|
+
def rowspan=(num)
|
311
|
+
raise ArgumentError if num.to_i < 0
|
312
|
+
@rowspan = num.to_i
|
313
|
+
modify_html("rowspan", @rowspan)
|
314
|
+
end
|
315
|
+
|
316
|
+
def rules(edges = nil)
|
317
|
+
@rules ||= nil
|
318
|
+
self.rules = edges if edges
|
319
|
+
@rules
|
320
|
+
end
|
321
|
+
|
322
|
+
def rules=(edges)
|
323
|
+
valid = %w/all groups rows cols none/
|
324
|
+
raise ArgumentError unless valid.include?(edges.to_s.downcase)
|
325
|
+
@rules = edges
|
326
|
+
modify_html("rules", @rules)
|
327
|
+
end
|
328
|
+
|
329
|
+
def span(num = nil)
|
330
|
+
@span ||= nil
|
331
|
+
self.span = num if num
|
332
|
+
@span
|
333
|
+
end
|
334
|
+
|
335
|
+
def span=(num)
|
336
|
+
raise ArgumentError if num.to_i < 0
|
337
|
+
@span = num.to_i
|
338
|
+
modify_html("span", @span)
|
339
|
+
end
|
340
|
+
|
341
|
+
def style(string = nil)
|
342
|
+
@style ||= nil
|
343
|
+
self.style = string if string
|
344
|
+
@style
|
345
|
+
end
|
346
|
+
|
347
|
+
def style=(string)
|
348
|
+
@style = string.to_s
|
349
|
+
modify_html("style", @style)
|
350
|
+
end
|
351
|
+
|
352
|
+
def summary(string = nil)
|
353
|
+
@summary ||= nil
|
354
|
+
self.summary = string if string
|
355
|
+
@summary
|
356
|
+
end
|
357
|
+
|
358
|
+
def summary=(string)
|
359
|
+
@summary = string.to_s
|
360
|
+
modify_html("summary", @summary)
|
361
|
+
end
|
362
|
+
|
363
|
+
def valign(position = nil)
|
364
|
+
@valign ||= nil
|
365
|
+
self.valign = position if position
|
366
|
+
@valign
|
367
|
+
end
|
368
|
+
|
369
|
+
def valign=(position)
|
370
|
+
valid = %w/top center bottom baseline/
|
371
|
+
raise ArgumentError unless valid.include?(position.to_s.downcase)
|
372
|
+
@valign = position
|
373
|
+
modify_html("valign", @valign)
|
374
|
+
end
|
375
|
+
|
376
|
+
def vspace(num = nil)
|
377
|
+
@vspace ||= nil
|
378
|
+
self.vspace = num if num
|
379
|
+
@vspace
|
380
|
+
end
|
381
|
+
|
382
|
+
def vspace=(num)
|
383
|
+
raise ArgumentError if num.to_i < 0
|
384
|
+
@vspace = num.to_i
|
385
|
+
modify_html("vspace", @vspace)
|
386
|
+
end
|
387
|
+
|
388
|
+
def width(num = nil)
|
389
|
+
@width ||= nil
|
390
|
+
self.width = num if num
|
391
|
+
@width
|
392
|
+
end
|
393
|
+
|
394
|
+
def width=(num)
|
395
|
+
if num =~ /%/
|
396
|
+
@width = num
|
397
|
+
else
|
398
|
+
raise ArgumentError if num.to_i < 0
|
399
|
+
@width = num.to_i
|
400
|
+
end
|
401
|
+
modify_html("width", @width)
|
402
|
+
end
|
403
|
+
end
|