From: Daniel Berger Date: 2003-06-12T00:58:25+09:00 Subject: [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