Re: Import macros into global namespace

Chris <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
>> Is it possible to import a library of macros into the main namespace?
>> We'd like to do this using Configuration.autoImport().
>
> Doesn't Configuration.setAutoIncludes do what you want?

It doesn't, so far as I know. Neither

     conf.setAutoIncludes(null, "mylibrary.ftl")

nor

     conf.setAutoIncludes("main", "mylibrary.ftl")

will put the macros in the main namespace. Is is possible to get them 
into that namespace?

> Maybe this can be worked around if you import the
> macro library with a non-conflicting name, then pass the macro library
> (the hash that #import creates) back to the data-model through a
> custom method of the a custom data-model root class, which then uses
> that for fall-backs. I never tried to do this, so I'm not sure if it
> has a catch...

Sounds like it might work. How do I get access to the hash that #import 
creates? And where?


------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.