Stefan Undorf | 22 May 16:50 2012
Picon

How to use nested directives?

Hi fmpplers,

I try to generate my menus dynamically and to activate the current menu item. So I use one directive
inside another but I do not know how to do it right. The following is taken from the example below:

    <#if outFile?index_of(m.item.link) != -1>  <!-- m.item.link is undefined -->
    <#if outFile?index_of(${m.item.link}) != -1>  <!-- syntax error -->

Complete example:

    <#assign menus = [
        {"item": {"name": "Motive", "link": "motive.html"}},
        {"item": {"name": "Action", "link": "action.html"}},
    ]>
    <#if currentLanguage == "es">
        <#assign menus = [
            {"item": {"name": "Motivos", "link": "es/motive.html"}},
            {"item": {"name": "Acción", "link": "es/action.html"}},
        ]>
    </#if>
    <ul class="nav">
        <#list menus as m>
            <li <#if outFile?index_of(m.item.link) != -1>class="active"</#if>>
                <a href="${m.item.link}">${m.item.name}</a>
            </li>
        </#list> 
    </ul>

How can I access the variable m.item.link in the #if?

(Continue reading)

Shelley, Ryan | 12 Apr 01:32 2012
Picon

Parsing TDD Files

I'd like to use the TDD parsing functionality for reading properties files for my application. I've used FMPP for generating configuration files from templates, but I'd like to skip the generation stage, and use a TDD as the data source for run-time settings. Is this possible, or can I use a particular sub-library of FMPP to accomplish this?  Thanks!

-Ryan
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
fmpp-open mailing list
fmpp-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fmpp-open
CsPéter | 28 Oct 15:05 2010
Picon

newbie problem

 

Hi!

I'm newbie to fmpp and I couldn't make a front-end application work so far. I hope someone can help me.
The ant build.xml looks like this (and works) :

<!--freemarker-->
<target name="freemarker" description="Freemarker test" depends="">
<taskdef name="freemarker" classname="freemarker.ext.ant.FreemarkerXmlTask">
<classpath>
<pathelement location="freemarker.jar" />
</classpath>
</taskdef>
<mkdir dir="sql" />
<freemarker basedir="${xml.dir}" destdir="${sql.dir}" includes="Actions.xml" template="${templates.dir}/test2.ftl" />  
<!--freemarker basedir="${xml.dir}" destdir="${html.dir}" includes="**/*.xml" template="${templates.dir}/test2.ftl" /-->  
</target>

My own ant task is this:
<!--excelgen-->
<target name="excelgen" description="Generates things" depends="jar">
        <taskdef name="excelgen" classname="ExcelGen" classpath="${classpath}"/>
<excelgen excels="excel1, excel2" ftls="elso.ftl" outputs="html" />  
    </target>

And my java file:

public void execute() {
try {
File f = new File("C:/workspace/TOOLS/excelgen/");
File basedir = new File("C:/workspace/TOOLS/excelgen/xml");
File destdir = new File("C:/workspace/TOOLS/excelgen/sql");
File include = new File("C:/workspace/TOOLS/excelgen/xml/Actions.xml");
File template = new File("C:/workspace/TOOLS/excelgen/templates/");
Settings s = new Settings(f);
s.add("sourceRoot", basedir.getAbsolutePath());
s.add("outputRoot", destdir.getAbsolutePath());
s.add("dataRoot", template.getAbsolutePath());
s.execute();
} catch (Exception e1) {
e1.printStackTrace();
}
log(msg);
}

The problem is, that it's just copies the Actions.xml file to the /sql directory.

directory path:
TOOLS ------------xml/Actions.xml
            -----------sql/
           ------------templates/test2.ftl
bulild.xml

I have tried a lot of things including set the "modes" settings, switching the directores and trying out new parameters (relative paths, put all sources to one directory etc) but I couldn't make it work. 
Thank you very much for any help.

cheers,
Peter

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
fmpp-open mailing list
fmpp-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fmpp-open
Chris | 10 Aug 08:34 2010
Picon

Freemarker with YAML Files


Hello,

i'd like to use the freemarker tool in my RubyOnRails Application. 

In the App i have much YAML Files with Properties.

Is there any way to use them with freemarker (or the cli version fmpp) ?!?

I have used the fmpp tool in different projekt but only with properties
files.... and my google search give me no results to "yaml and freemarker"
:-)

Thank you very much for your help!!

lg
Chris
--

-- 
View this message in context: http://freemarker.624813.n4.nabble.com/Freemarker-with-YAML-Files-tp2319361p2319361.html
Sent from the fmpp-open mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
jyothisree | 19 Jul 13:18 2010

freemarker in struts2 application


I have a struts2 application ,where in the jsp page i have struts2 tag
checkbacklist ,which displays the list of checkboxes in a row ,i want to
display it in the column form , for that i have made changes in the
checkboxlist.flt file as 

<#if parameters.cssStyle?exists>
<#if "${parameters.cssStyle?html}" == "vertical">
<#if itemCount%2==0>
<br><#rt/>
<#else>&nbsp;
</#if>
</#if>
</#if>

In this i can display the way i want to display the checkboxes in 2 columns
,but the problem is the checkboxes starting from the 2nd column are not in
the line 
something like this

  1 chkbox     2 chkbox
  3 chkbox        4 chkbox
  5 chkbox    5 chkbox 

 i want it to be as 
  1 chkbox            2 chkbox
  3 chkbox            4 chkbox
  5 chkbox            5 chkbox 

What do i do for the above code 

--

-- 
View this message in context: http://freemarker.624813.n4.nabble.com/freemarker-in-struts2-application-tp2293826p2293826.html
Sent from the fmpp-open mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
alebu | 4 Jan 21:20 2010
Picon

How to include java code into freemarker's data model in fmpp?

Hi all,
How can I specify FMPP to include some compiled java code or jar files
in the freemarker classpath? I need it because I want to use some of
the functions written with java from freemarker templates and because
FMPP instanciates freemarker instance, I can't affect a classpath it
passes to it.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
alebu | 7 Dec 17:08 2009
Picon

Using FMPP Output Tags separately

Hi all,

I need some guidelines about FMPP API. I am interested in collecting
data for FMPP engine using my own code. In general, I only interested
in those wanderfull tags, that allows to create multiple outputs from
single template. The questions are:
1) What objects are responsible for actual generation part of code?
2) How to configure them ? I was looking at code and I saw that
TemplateEnvironment has some tags definitions, and Engine is using it
somehow.
3) How to specify to search templates in classpath (it is important
for me). Also, if templates uses some macros and additional includes,
then it must be specified too. It is probably more Freemarker
question, but still...

In few words, i want to write a code that:
1) Takes some data (as freemarker content)
2) Instanciate FMPP Engine, configures it to use those tags and search
templates and other Freemarker specific resources in classpath.
3) Processes data. Here I need to correctly handle output.

Or maybe it is worth to somehow move those fmpp specific tags into
freemarker environment? In this case, how can it be done?

General overview of solution will be fine for me, just point me please
on the right directions (classes, execution chain, etc).

Thanks in advance!

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
Shelley, Ryan | 28 Oct 01:01 2009
Picon

FMPP SourceFile Classpath

Is it possible to supply a classpath to the sources and inheritConfiguration directives within a FMPP configuration file?

 

Thanks!

 

-Ryan

 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fmpp-open mailing list
fmpp-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fmpp-open
Shelley, Ryan | 27 Oct 05:45 2009
Picon

Referencing Hash Values from Keys

I’m new to Freemarker, but have used other templating languages in the past.  Currently, I’m attempting to use FMPP to generate configuration files, but having a bit of difficulty referencing hash values from keys.  Here is my TDD and sample template:

 

TDD:

 

{

      pools: [

            {

                  poolName: Foo

                  poolConnections: ServiceA

            },

            {

                  poolName: Bar

                  poolConnections: ServiceB

            }

      ]

}

 

Template:

 

This will output fine:

<#list pools as pool>

      <#assign keys = pool?keys >

      <#list keys as key>

            ${key} = ${pool[key]}

      </#list>

</#list>

 

This will get an error on poolConnections:

<#list pools as pool>

      ${pool.poolName}

      ${pool.poolConnections}

</#list>

 

In the first list iteration, everything is output correctly, but I have no control over the keys.  However, the second iteration fails on “${pool.poolConnections}” with the error:

 

Caused by: freemarker.core.InvalidReferenceException: Expression pool.poolConnections is undefined (notice the error is not on pool.poolName)

 

If I take “${pool.poolConnections}” out, it works fine (I see the value for poolName), but I kind of need to be able to access “poolConnections”!

 

I’ve tried this with different combinations of “${pool[poolConnections]}” and “${pool[‘poolConnections’]}” and “${pool.get(poolConnections)}” but none seem to be correct.  I’ve been back and forth through the documentation and the examples, but none seem to cover accessing a hash value by it’s key directly.

 

Suggestions?  Thanks!

 

-Ryan

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
fmpp-open mailing list
fmpp-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fmpp-open
Daniel Dekany | 15 Mar 16:11 2009
Picon

FMPP 0.9.14 is released

Download:
http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.14.tar.gz
or
http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.14.zip

Changes
-------

Bug fixes:

* Fixing bug that caused "skipUnchanged" to skip a file when the
  destination was newer than the source. Now it only skips files when
  the modification date of the source and destination files are
  exactly the same.

* Fixing some TDD parser crashes occurring when parsing invalid TDD.

* Preventing obviously useless traversing inside SVN and CVS
  directories.

* Fixed some typos in the documentation.

New features, improvements:

* FMPP now can create empty directories using one of the two new
  features (reminder: FMPP creates output directories on-demand before
  an actual output file is created in them, hence usually it doesn't
  create empty directories):

  - If a directory file contains a file named "createdir.fmpp" then
    that will ensure that the containing directory will exist in the
    output as well. The "createdir.fmpp" file itself will not appear
    in the output, it's only a marker.

  - New setting, "alwaysCreateDirectories": If this is set to true,
    all processed directories will produce a corresponding output
    directory, even when that directory will be empty.

* The XML data loader now supports XInclude-s by setting its
  "xincludeAware" option to true.

* To follow the Ant conventions, now "sourceRoot" can alternatively be
  specified with the "srcdir" attribute, and "outputRoot" with the
  "destdir" attribute of the Ant task.

* API: New JavaBean propery in fmpp.Engine and fmpp.setting.Settings:
  "dontTraverseDirectories". It should be set to true by front-ends
  that explicitly specify the list of all source files and source
  directories, rather than expecting the Engine to discover them. Till
  now such front-ends only specified the list of files, so this
  property wasn't needed. However, to support the new
  alwaysCreateDirectories setting, now the list of directories should
  be passed as well, and hence the need for this new property.

* Updated freemarker.jar and the included FreeMarker Manual to 2.3.15.

--

-- 
Best regards,
 Daniel Dekany

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
junk | 13 Feb 18:29 2009

Prohibited package name: java.lang

Hi,

i'm giving fmpp a try but ran into this exception:

java.lang.SecurityException: Prohibited package name: java.lang

Any idea oof what might be causing this ?

(i attached the full ant debug output to this message)

Thanks a lot
Immanuel
Attachment (bt.log): application/octet-stream, 50 KiB
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
fmpp-open mailing list
fmpp-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fmpp-open

Gmane