From: Lane S. <la...@op...> - 2003-06-24 16:08:17
|
I do a lot of code generation and I would like to be able to generate WM code as well. The problem I run into is streaming an block within a template: #setblock $JavaTemplate { class $ClassName bla, bla } ## how to cleanly evaluate $JavaTemplate and stream this to home/org/webmacro/dyn/$ClassName.java? Maybe someone could propose a practice here. I do not like mine currently. Possibly a context tool which is a writer? $EvalWriter(Stream, template, context)??? -Lane What is the pattern going to look like Brian Goetz wrote: >>#output file="some/file.txt" { >> #eval $t using { "foo":"a", "bar":"b" } >>} >> >> > >I really don't like this. > >Templates should be able to evaluate to two places: > - the template output > - variables in the context > >That's it. Not only is it a security risk to do otherwise, but its >inviting all sorts of weird side effects. > > > > |