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().
Here's the issue. For our app, we have a library of macros and a bunch
of variables in the datamodel. We also have a few directives in the
datamodel. We're currently forced to do this:
${myvariable}
[@mynamespace.mymacro/]
[@mydirective/]
It's gotten confusing and frustrating for our designers because
sometimes they have to use the namespace and sometimes not.
It doesn't seem possible to put the datamodel into the same namespace as
the library. If I do this:
HashMap rootMap = new HashMap();
HashMap myVariables = new HashMap();
myVariables.put("foo", "bar");
rootMap.put("mynamespace", myVariables);
then ${mynamespace.foo} yields a "not found" error. If I get rid of the
library autoimport then it works ok.
------------------------------------------------------------------------------
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