I was thinking today about how much I hate writing scripts to generate
HTML and I sat down and wrote some code.  I'm thinking about making a
simple toolkit to generate HTML in an abstract way.  Here's my sample
code:

 # tests a simple HTML generation toolkit - this is how a working
script ought to work

data = [[1, 2, 3], [4, 5, 6]]

puts RHTk.new do
	title "A Test of RHTk - The Ruby HTML ToolKit"
	include_css "style/rhtk.css"
	body do
		header1 "Here's a sample header", :class => 'modern'
		table do
			data.each do |i|
				row do
					data[i].each do |d|
						column d
					end
				end
			end
		end
		out "that's all for now"
	end
end

The RHTk constructor assembles a string of HTML based on all the code
executed within its block. The output would be neatly tabified, giving
you something like this:

<html>
	<head>
		<title>
		<link rel="stylesheet" href="style/rhtk.css">
	</head>
	<body>
		<h1 class="modern">Here's a sample header.</h1>
		<table>
		<!-- main table begin -->
			<tr>
				<td>
					1
				</td>
				<td>
					2
				</td>
				<td>
					3
				</td>
			</tr>
			<tr>
				<td>
					4
				</td>
				<td>
					5
				</td>
				<td>
					6
				</td>
			</tr>
		<!-- main table end -->
		that's all for now
	</body>
</html>

Is this worth pursuing?  Is there something already in existence that
does the same thing?  I'd like to hear what everyone's thoughts about
this are.

Bill