[ANN] html-table 0.0.1

Hi all,

I’m happy to announce the release of html-table, a Ruby interface for
generating HTML Tables without having to manually generate HTML tags
yourself. While inspired by Perl’s HTML::Table, the API is only
somewhat similar and the internals are completely different. The goal
was to provide a widget-like interface where

represents a “row” and and represent a column.

For now, I am releasing this as “Beta” because I have not entirely made
up my mind about the API. Mostly, I’ll be waiting for feedback to see
how you all like it. Also, please see the “Future Plans” section.

Synopsis:

require “html/table”

Create a table

table = HTML::Table.new{ |t|
t.border = 1
t.align = “center”
}

Create a TableRow object () add it explicitly

row0 = HTML::TableRow.new{ |r|
r.align = "left"
r.bgcolor = “red”
}

table.add_tr(row0)

Create a row implicitly, plus add content, on the fly

row1 = table.add_tr{ |r|
r.align = "right"
r.bgcolor = "green"
r.content = [“foo”,“bar”] # Add 2 TableData objects (columns)
}

Create a TableData object () and add it explicitly

col0 = HTML::TableData.new{ |d|
d.content = "Hello World!"
d.nowrap = true
}

row0.add_td(col0)

Go back and configure row 1, column 1 (“bar” from above)

table.configure(1,1){ |d|
d.content = "new bar"
d.width = 5
d.height = 10
}

Finally, print the table

puts table.html

OUTPUT

Hello World!
foo new bar

There are several examples included in the documentation as well.
Please see the ‘doc’ and ‘doc/examples’ directories.

Enjoy!

Dan

i did something similar a while back - it was one of my first ruby libs so
it’s pretty dated but you might find it interesting.

http://eli.fsl.noaa.gov/eg/ruby/html/widget.rb

-a

Hi all,

I’m happy to announce the release of html-table, a Ruby interface for
generating HTML Tables without having to manually generate HTML tags
yourself. While inspired by Perl’s HTML::Table, the API is only
somewhat similar and the internals are completely different. The goal
was to provide a widget-like interface where represents a “row” and

and represent a column.

For now, I am releasing this as “Beta” because I have not entirely made
up my mind about the API. Mostly, I’ll be waiting for feedback to see
how you all like it. Also, please see the “Future Plans” section.

Synopsis:

require “html/table”

Create a table

table = HTML::Table.new{ |t|
t.border = 1
t.align = “center”
}

Create a TableRow object () add it explicitly

row0 = HTML::TableRow.new{ |r|
r.align = “left”
r.bgcolor = “red”
}

table.add_tr(row0)

Create a row implicitly, plus add content, on the fly

row1 = table.add_tr{ |r|
r.align = “right”
r.bgcolor = “green”
r.content = [“foo”,“bar”] # Add 2 TableData objects (columns)
}

Create a TableData object () and add it explicitly

col0 = HTML::TableData.new{ |d|
d.content = “Hello World!”
d.nowrap = true
}

row0.add_td(col0)

Go back and configure row 1, column 1 (“bar” from above)

table.configure(1,1){ |d|
d.content = “new bar”
d.width = 5
d.height = 10
}

Finally, print the table

puts table.html

OUTPUT

Hello World!
foo new bar

There are several examples included in the documentation as well.
Please see the ‘doc’ and ‘doc/examples’ directories.

Enjoy!

Dan

-a

···

On Thu, 12 Jun 2003, Daniel Berger wrote:

====================================

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
~ > ruby -e ‘p(%.\x2d\x29…intern)’
====================================