Shared variables vs. auto-imported templates (freemarker-tags plugin)
Daniel Henrique Alves Lima <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <CABKeyuQsaLG8r7YLdU_r1NDkmH-e-mNW1+N+WvfZ+CG46m6ieQ@mail.gmail.com> |
Hi, everybody.
Daniel, I'm pretty sure we've talked about this before, but I
can't remember where (I read
http://freemarker.624813.n4.nabble.com/Configuration-setup-td3315086.html
and http://freemarker.624813.n4.nabble.com/Grails-integration-td3161875.html).
Can you help me?
I'm rewriting freemarker-tags and exposing the directives and
functions as values in shared maps
(https://github.com/daniel-lima/grails-freemarker-tags-plugin/blob/master/src/java/org/codehaus/groovy/grails/plugins/freemarker/AbstractTagLibAwareConfigurer.java#L154).
Assume that my tests will be the base of our discussion:
https://github.com/daniel-lima/grails-freemarker-tags-plugin/blob/master/test/integration/org/codehaus/groovy/grails/plugins/freemarker/TagLibAwareConfigurerTests.groovy#L46
http://pastie.org/2203040
Now, my doubt: If my data model ('binding' in my test case)
contains a variable named as 'g', it will shadowing '[@g.form /]',
right?
/* template, data model */
parseFtlTemplate('[#ftl/][@g.form /]', [g: 'random text'])
Will the shadowing also happen if I do the auto-importing of
libraries containing macro or function declarations (instead of using
shared variables)? Something like:
[!-- g.ftl --]
[#assign form = "TagLibToDirectiveAndFunction"?new('g', 'form')]
// AbstractTagLibAwareConfigurer.java
configuration.addAutoImport('g', 'g.ftl')
/* template, data model */
parseFtlTemplate('[#ftl/][@g.form /]', [g: 'random text'])
Is my question clear? I can try to rewrite it, if you prefer.
Thanks in advance.
Best regards,
Daniel.
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev