From: Lane S. <la...@op...> - 2003-06-24 07:04:18
|
Keats, Sebastian: The templet is now a powerful language construct for WM. Good work, Keats! Can a templet contain a templet? Re: #output file="some/file.txt" { #eval $t using { "foo":"a", "bar":"b" } } Is the above block evaluate or saved literally for later evaluation? -Lane Keats wrote: >----- Original Message ----- > > >>I'm wondering, whether #eval should really be a directive. I think I >> >> >dislike > > >>it, because you don't have a choice anymore, what to do with the evaluated >>templet: It always gets printed. >> >> > >Well you can always wrap it in a #setblock if you need the output for >something else. > > > >>Remember Lane's wish to store templet's somewhere out of a wm-file? My >>proposal was to create a "Writer"-Tool, that can take any macro and store >> >> >it > > >>somewhere. >> >>So with your proposal, you could do >> >>#template $t { bla bla blub blub $foo $bar } >>$Writer.write("some/file.txt",$t) >> >>if $t is a macro, but if you want to change the context, you couldn't. But >> >> >if > > >>you would add a method "withContext(Map context)" to $t, you could do >>$Writer.write("some/file.txt",$t.withContext({"foo":"a", "bar" : "b"}) >> >>Do you understand my point? What was the reason for needing an >> >> >#eval-directive > > >>in the first place? >> >> > >You could still do this sort of thing with the $Template tool. People >didn't seem to like the template tool syntax, so I came up with the >directive approach which seems a bit more user friendly. > >My approach to the above would be to use a directive for the writer, say >#output > >#output file="some/file.txt" { > #eval $t using { "foo":"a", "bar":"b" } >} > >Would this work for you? Thanks for the feedback. > >Keats > > > >------------------------------------------------------- >This SF.Net email is sponsored by: INetU >Attention Web Developers & Consultants: Become An INetU Hosting Partner. >Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! >INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php >_______________________________________________ >Webmacro-devel mailing list >Web...@li... >https://lists.sourceforge.net/lists/listinfo/webmacro-devel > > > |