From: Keats <ke...@ea...> - 2003-06-24 16:28:50
|
Yes this is exactly what I had envisioned the #output directive for. It's not something you'd normally use on a Web site, but it has lot's of uses for stand-alone apps. Keats ----- Original Message ----- From: Lane Sharman To: Brian Goetz Cc: Keats ; Sebastian Kanthak ; web...@li... Sent: Tuesday, June 24, 2003 12:01 PM Subject: Re: [Webmacro-devel] #templet directive 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. |