Re: Nested Java directives - best practice on how to make values available to inner directive?
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Saturday, February 2, 2008, 6:03:44 PM, Attila Szegedi wrote: > On 2008.02.02., at 17:24, Daniel Dekany wrote: > >> Saturday, February 2, 2008, 3:55:15 PM, Attila Szegedi wrote: >> >>> On 2008.01.31., at 11:16, Daniel Dekany wrote: >>> >>>> To fellow FM developers: >>>> >>>> - Given that 2.4 will not be released in the foreseeable future, and >>>> even then it will not be 100% BC, parent-children communication >>>> definitely should be backported to 2.3.x. This is again a very basic >>>> feature for a template language, shame that it isn't there for >>>> years. (Reminds me to the history of #nested...) Would backporting >>>> be difficult? >>>> >>>> - Can TemplateDirectiveModel and TempateTransformModel calls >>>> participate as parents in the current trunk? (And as children for >>>> that mater?) I don't think so... of course, they should be able to. >>>> Java and FTL are just to languages to implement custom directives. >>> >>> We should ideally make it so that the engine code doesn't deal with >>> the Macro class at all. Engine would only rely on >>> TemplateDirectiveModel, and we'd make Macro a TemplateDirectiveModel. >>> Then we'd achieve actual equality between a [#macro] and a Java- >>> defined TemplateDirectiveModel. >> >> That's highly desirable indeed, and also #function-s should be >> TemplateMethodModelEx-s (as it was noted for several times BTW). >> However, as far as I understand, it still wouldn't solve the issue >> with the parent-children communication (i.e., ?scope in FM 2.4), as >> for that the parent must have *FTL* local variables. So, we need to >> add something to the API by which a TemplateDirectiveModel, which was >> written entirely in Java Language, can create a local variable map, so >> it can be accessed by the children like >> theParentDirective?scope.theLocalVariable. > > Yep, we would add whatever needs to be added to the public API. Something like adding a method to f.c.Environment: Environment.Namespace createLocalScopeFor(TemplateDirectiveModel|TemplateTransformModel) -- Best regards, Daniel Dekany ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/