OK, this is good. The idea here is that you want a way at the point where
you would call table to dynamically define #makerow. I am talking about a
way to pass in the definition of #makerow at usage time. As the need to
reuse layout elements grows so would the need to gain better control over
the internals.

#makerow might need to set the widths of columns, but the enclosing table
still provides useful style elements and would need to be reused.

I don't know if a different example will help or not. Here the idea has
nothing to do with tables or row. Here the idea is to reuse the HTML layout
needed to throw box around some element.

#vmacro(boxIt, $width, $body)
<table width=$width cellpadding=1 cellspacing=0 border=0><tr><td bgcolor="
#000000">
  <table cellpadding=5 cellspacing=0 border=0 width="100%">
    <tr>
      <td bgcolor="#f0f0f0">
        $body
      </td></tr></table>
    </td></tr></table>
#end

Now its arguable that there is enough layout there to make desire reuse.
The normal macro system seems to handle this too, what I am suggesting is
that when you call such a thing you can specify the body inline.

#boxit("90%")
  #body
     <p>This is the stuff that gets put inside a box</p>
  #end
#end

 This example is different because I am not asking VM to parse the argument
and use it for resubstitution. Now I think this format is easy for an HTML
artist to follow, write and reuse. The more complex example is where you
want an "expanded inline argument" to act as a macro such as in the
#makerow example. I also want to be able to pass in row definitions at the
time I call it. If I have two data sets on the same page and want the same
table surround, but different internals (row/cell layout) I think this is
useful.

Did I make things better or worse? :)

-Ben



                                                                                       
                    
                    "Geir Magnusson                                                    
                    
                    Jr."                    To:     [EMAIL PROTECTED]    
                    
                    <geirm@optonline        cc:                                        
                    
                    .net>                   Subject:     Re: Question/Idea             
                    
                    Sent by:                                                           
                    
                    [EMAIL PROTECTED]                                                   
                    
                    lny.cv.net                                                         
                    
                                                                                       
                    
                                                                                       
                    
                    03/30/2001 12:32                                                   
                    
                    PM                                                                 
                    
                    Please respond                                                     
                    
                    to velocity-dev                                                    
                    
                                                                                       
                    
                                                                                       
                    



I have to admit, I still don't get it, but I think there is a bit of
cloudiness in how you percieve that VMs work.  Briefly :

All VMs are 'line directives', in that they don't have a body like #if()
does.

For table generation, you could define two VMs as :

#macro( table $title $data )
  Table of $title
  <table>
    #foreach( $row in $data )
      #makerow( $row )
    #end
  </table>
#end

#macro( makerow $rowdata )
   <tr>
    #foreach( $field in $rowdata)
     <td>$field</td>
    #end
   </tr>
#end


and then make a table as :

#table( "Foobar" $mydata )

which would call the VM table, which would call the VM  makerow.

Now, starting with this as a basis, what doesn't this solve for you, or
what should be changed?







Reply via email to