Niklas Frykholm wrote: > [Hal E. Fulton] > > Suppose I want to follow an H1 > > header with an H2 header. Fine... > > > > cgi.out do > > cgi.html do > > cgi.body do > > cgi.h1 { "Larger header" } + > > cgi.h2 { "Smaller header" } > > end > > end > > end > ... > > Couldn't it have been written in such > > a way that output would have been > > done as we went along, or at least > > collected as we went along? > > I agree that this is not very good... it is too easy to forget the '+'. > But outputting the data directly is not very good either... you may want > to postprocess the data or (for example) write it to a database. Also, > I do not think that HTML generation really belongs in the CGI class. > But I do like the idea of using ruby blocks to indicate tag nesting. With my HTML lib I wrote for Ruby: #!/usr/local/bin/ruby #-*-Ruby-*- require 'HTMLoop' doc = HTMLdoc.new(H_title => 'Ruby HTMLoop Example', H_address => 'dtillman / oxgoad.org') doc << h1("Larger header") doc << h2("Smaller header") myTable = HTMLtable.new(H_border => 3, H_bcolor => '#dd9999') # Array of rows and columns. foo = [['Column 1', 'Column 2', 'Column 3'], ['Larry', 'Moe', 'Curly']] myTable << foo doc << myTable puts doc If there is sufficient interest I will put together some documentation and make it available. -Dave -- How absolute the knave is! We must speak by the card, or equivocation will undo us.