From: Keats <ke...@ea...> - 2003-06-23 14:38:12
|
----- 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 |