On Tuesday 04 September 2001 14:53, David Tillman wrote: > 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 "Webification" is certainly a desirable goal, and HTML cum CGI is a foundational aspect of this. Your thoughts vis a vis structure echo mine (I was toying with this a few weeks ago, lamenting the fact that I have to do CGI via Perl as our current hosting services do not yet support Ruby. A suggestion: use "standard" language for your passed hash keys, say "bgcolor" rather than "H_bcolor". The result would be that anyone reasonably skilled in HTML could look at the Ruby code and gain an immediate understanding of what is happening. Ruby is a wonderfully expressive language, a fact that can speed its adoption in the mainstream world of web design when compared to Perl and (worse) Java. Nonetheless, it still provides the power for a strong, experienced programmer to create high end web applications while still easing the way for a new, or cross discipline, designer to upgrade the functionality of their creations. Or, so -I- believe :-) Regards, Kent Starr elderburn / mindspring.com