5.7.2. Freemarker settings
MetaFactory supports multiple template engines. Since 2011 Freemarker is supported by MetaFactory. Freemarker is a very powerful template engine to produce source code. Like Velocity, freemarker supports libraries-containing-macros. To make these macro libraries available for other freemarker templates the freemarker element is used:
Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?xml version="1.0" encoding="UTF-8"?>
<pattern xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.firstbase.nl/xsd/personaliom/pattern"
xsi:schemaLocation="http://www.firstbase.nl/xsd/personaliom/pattern
http://www.firstbase.nl/xsd/personaliom/pattern.xsd">
...
<freemarker>
<freemarkerLibrary namespace="myLib1">relative path to freemarker file with macro's</freemarkerLibrary>
<freemarkerLibrary namespace="myLib2">some other path</freemarkerLibrary>
</freemarker>
...
</pattern>
|
Each freemarkerLibary element loads a freemarker template file. The macro’s defined in this template are made available to the template engine in the specified namespace. If the template file can’t be loaded, MetaFactory returns a error and stops loading the pattern.
Example of a pattern with 2 freemarker libraries defined:
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?xml version="1.0" encoding="UTF-8"?>
<pattern xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.firstbase.nl/xsd/personaliom/pattern"
xsi:schemaLocation="http://www.firstbase.nl/xsd/personaliom/pattern
http://www.firstbase.nl/xsd/personaliom/pattern.xsd">
...
<freemarker>
<freemarkerLibrary namespace="pf">jsf/primefaces/library/primefacesLayout.ftl</freemarkerLibrary>
<freemarkerLibrary namespace="tl">universal/library/layout/tableLayout.ftl</freemarkerLibrary>
</freemarker>
...
</pattern>
|