Mauricio Fernández
11/23/2003 9:20:00 AM
On Sun, Nov 23, 2003 at 01:50:29AM +0900, John W. Long wrote:
> Last night I started prototyping some of my ideas and came up with the
> following:
[...]
> hg = HtmlGenerator.new
> puts hg.render(Html4) {
> encoding = "US/English"
> head {
> title { "My Document" } +
> meta(:name => "description", :content => "this is a description of this
> document")
> } +
> body {
> h1 { "Heading 1" } +
> p { "A small paragraph." } +
> h2 { "Heading 2" } +
> p { b { "Bold" } + " " + i { "Italic" } }
> }
> }
You can use a technique similar to flgr's Junction or oGMo's criteria to build a
"parse tree".
What would be really cool would be taking a DTD and generating the Ruby
code from that that validates the document as it is built.
It would be possible to define how blocks can be nested, etc, in
practice, ensuring that no illegal sequence of calls is made.
--
_ _
| |__ __ _| |_ ___ _ __ ___ __ _ _ __
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
Are Linux users lemmings collectively jumping off of the cliff of
reliable, well-engineered commercial software?
-- Matt Welsh