From: Adam Van Den Hoven Date: 2005-09-27T08:47:44+09:00 Subject: Re: Embedded Ruby and Tag Libs The problem is that I LOVE XML, and find it easy to work with, mostly because its easy to abstract complex things with it... which is how I think. Without thinking of MUCH better ways to do this, I submit the following: I would then do much the same thing that rails does now where you would assume (but provide ways to explicitly set) things like localization key for the label, the controller to call etc. I would look at the model, "figure out" that name is a string, password is secret, person is boolean and description is text and render the correct markup that I define for each of those field types. Look to see if a Person is already provided (and assume an update) otherwise create one (and assume a New). In rough hand waving. Keep in mind that I'm looking for a way to define my tag, not for someone to define my tag. I'm assuming that whatever parser converts <%= ... %> in to ruby code can just as easily be setup to do the same thing with tags, maybe using REXML (or what ever its called). It just needs to be more precise. Adam On 26-Sep-05, at 4:30 PM, James Edward Gray II wrote: > On Sep 26, 2005, at 5:56 PM, Adam Van Den Hoven wrote: > > >> James, >> >> I agree, except that it starts to fall apart as you get more complex. >> >> Lets take an example from rails that REALLY annoys me: form_tag. >> It follows largely the same form you suggest. >> >> Right now to make a form in rails you do the following: >> >> <%= form_tag :controller=>"foo" :action=>"bar" %> >> Name: >> <%= text_field "person", "name", "size" => 20 %> >> Password: >> <%= password_field "person", "password", "maxsize" => 20 %> >> Single?: >> <%= check_box "person", "single" %> >> Description: >> <%= text_area "person", "description", "cols" => 20 %> >> >> <%= end_form_tag %> >> >> There's no easy way to encapsulate this into a single method, >> although Devin (as I'm writting this) has some good suggestions. >> > > Would you mind showing how you would clean this up with an XML syntax? > > I personally find XML very wordy. > > James Edward Gray II > > >