fmpp-open Mailing List for FMPP: FreeMarker-based File PreProcessor (Page 2)
Brought to you by:
ddekany
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(23) |
Aug
(4) |
Sep
(11) |
Oct
(7) |
Nov
|
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
(2) |
Oct
(9) |
Nov
(2) |
Dec
|
2005 |
Jan
(2) |
Feb
(9) |
Mar
|
Apr
(1) |
May
|
Jun
(11) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2006 |
Jan
(2) |
Feb
(14) |
Mar
(4) |
Apr
|
May
(6) |
Jun
(7) |
Jul
(7) |
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
(2) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
(3) |
2010 |
Jan
(9) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
(2) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Daniel D. <dd...@fr...> - 2009-10-28 14:43:52
|
Wednesday, October 28, 2009, 2:39:00 AM, Daniel Dekany wrote: > Wednesday, October 28, 2009, 1:01:26 AM, Shelley, Ryan wrote: > >> Is it possible to supply a classpath to the sources and >> inheritConfiguration directives within a FMPP configuration file? > > No, that's a Java concern. You have to set up the Java environment > *before* calling FMPP. Which is not at all trivial to do for those who are not wrestled in Java... so, here is the recipe: (a) Easy but dirty solution: Just drop the jar into $FMPP_HOME/lib, and it will automatically see it, but only when you are using the $FMPP_HOME/bin/fmpp shell script for running the FMPP projects. This has global effect in the sense that all FMPP projects that are run with $FMPP_HOME/bin/fmpp will see the extra jars added there. (b) The clean solution: Create a "lib" sub-directory in your FMPP *project* directory, and drop the extra jar into there. Then, in the same directory you should create a bash script (or .bat, on Windows) that runs FMPP with your own custom class-path: On Linux/UN*X: java -cp ./lib/yourExtra1.jar:./lib/yourExtra2.jar:$FMPP_HOME/lib/fmpp.jar fmpp.tools.CommandLine On Windows: java -cp .\lib\yourExtra1.jar;.\lib\yourExtra2.jar;%FMPP_HOME%\lib\fmpp.jar fmpp.tools.CommandLine Note that the scrip assumes that the working directory is already your project directory (you may need to "cd" into it as the first step in the script). Also it assumes that you have an FMPP_HOME environment variable; if you don't have it, not a problem, just replace it with a concrete path in the above scripts (or better, define the environment variable locally in the scrip). Yeah, someday I should invest into writing a native launcher app. that does all the Java setup magic automatically... /-: >> Thanks! >> >> -Ryan -- Best regards, Daniel Dekany |
From: Daniel D. <dd...@fr...> - 2009-10-28 01:56:03
|
Wednesday, October 28, 2009, 1:01:26 AM, Shelley, Ryan wrote: > Is it possible to supply a classpath to the sources and > inheritConfiguration directives within a FMPP configuration file? No, that's a Java concern. You have to set up the Java environment *before* calling FMPP. > Thanks! > > -Ryan > -- Best regards, Daniel Dekany |
From: Shelley, R. <Rya...@di...> - 2009-10-28 00:01:45
|
Is it possible to supply a classpath to the sources and inheritConfiguration directives within a FMPP configuration file? Thanks! -Ryan |
From: Daniel D. <dd...@fr...> - 2009-10-27 17:59:04
|
Tuesday, October 27, 2009, 6:15:48 PM, Shelley, Ryan wrote: > Well, I think I'm just not familiar with FM yet, and I'm running this as > a Maven FMPP Ant Task, so what it seems was happening was that it was > pulling in a different config file than I thought, and that config file > didn't have a "poolConnections" value in one of the "pools", and since > FM isn't as lenient with missing keys it was throwing an error. Looks > like I need to add some existence checking prior to accessing the hash > value. Sorry for the false alarm. I'm going to keep at it, but I think > it was just user-error. Thanks for checking! FreeMarker wants you to be explicit about optional stuff. (Like in this case it certainly helped you to find a mistake... you pick up the wrong config file or something like that.) If you know a variable is optional (i.e, *validly* missing or null), please use missing value handler operators: http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_missing -- Best regards, Daniel Dekany > -Ryan > > -----Original Message----- > From: fmp...@li... > [mailto:fmp...@li...] On Behalf Of Daniel > Dekany > Sent: Tuesday, October 27, 2009 1:48 AM > To: FMPP open discussion > Subject: Re: [FMPP] Referencing Hash Values from Keys > > Tuesday, October 27, 2009, 5:45:11 AM, Shelley, Ryan wrote: > >> 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 > > Don't... it should work the way you tried to do it: > pool.poolConnections > > I copy-pasted your above snippets into an FMPP project and it works > fine here. Even if you use different versions than me, I don't know > about any bugs in FreeMarker or FMPP bugs that would spoil a such > basic operation. Are you absolutely sure you don't have a typo > somewhere, and that you look at the files that your project actually > uses? > >> "${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. > > FreeMarker documentation does. It's myMap.myKey or > myMap[WhateverExpressionThatEvaluatesToAString] (like myMap["myKey"] > or myMap[aVariable], myMap["foo_" + i], etc.). > >> Suggestions? Thanks! >> >> -Ryan > |
From: Shelley, R. <Rya...@di...> - 2009-10-27 17:16:08
|
Well, I think I'm just not familiar with FM yet, and I'm running this as a Maven FMPP Ant Task, so what it seems was happening was that it was pulling in a different config file than I thought, and that config file didn't have a "poolConnections" value in one of the "pools", and since FM isn't as lenient with missing keys it was throwing an error. Looks like I need to add some existence checking prior to accessing the hash value. Sorry for the false alarm. I'm going to keep at it, but I think it was just user-error. Thanks for checking! -Ryan -----Original Message----- From: fmp...@li... [mailto:fmp...@li...] On Behalf Of Daniel Dekany Sent: Tuesday, October 27, 2009 1:48 AM To: FMPP open discussion Subject: Re: [FMPP] Referencing Hash Values from Keys Tuesday, October 27, 2009, 5:45:11 AM, Shelley, Ryan wrote: > 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 Don't... it should work the way you tried to do it: pool.poolConnections I copy-pasted your above snippets into an FMPP project and it works fine here. Even if you use different versions than me, I don't know about any bugs in FreeMarker or FMPP bugs that would spoil a such basic operation. Are you absolutely sure you don't have a typo somewhere, and that you look at the files that your project actually uses? > "${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. FreeMarker documentation does. It's myMap.myKey or myMap[WhateverExpressionThatEvaluatesToAString] (like myMap["myKey"] or myMap[aVariable], myMap["foo_" + i], etc.). > Suggestions? Thanks! > > -Ryan -- Best regards, Daniel Dekany ------------------------------------------------------------------------ ------ 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 fmp...@li... https://lists.sourceforge.net/lists/listinfo/fmpp-open |
From: Daniel D. <dd...@fr...> - 2009-10-27 08:47:51
|
Tuesday, October 27, 2009, 5:45:11 AM, Shelley, Ryan wrote: > 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 Don't... it should work the way you tried to do it: pool.poolConnections I copy-pasted your above snippets into an FMPP project and it works fine here. Even if you use different versions than me, I don't know about any bugs in FreeMarker or FMPP bugs that would spoil a such basic operation. Are you absolutely sure you don't have a typo somewhere, and that you look at the files that your project actually uses? > “${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. FreeMarker documentation does. It's myMap.myKey or myMap[WhateverExpressionThatEvaluatesToAString] (like myMap["myKey"] or myMap[aVariable], myMap["foo_" + i], etc.). > Suggestions? Thanks! > > -Ryan -- Best regards, Daniel Dekany |
From: Shelley, R. <Rya...@di...> - 2009-10-27 04:45:57
|
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 |
From: Daniel D. <dd...@fr...> - 2009-03-15 15:11:57
|
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 |
From: Daniel D. <dd...@fr...> - 2009-02-13 18:26:27
|
Friday, February 13, 2009, 6:29:46 PM, ju...@ig... wrote: > 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 don't think it's FMPP or FreeMarker specific. It's like if rt.jar (that contains the core classes that come with the Java platform, like the java.lang classes) is in the CLASSPATH (or otherwise becomes available to some class loader that is not the bootstrap classloader). So check the CLASSPATH, and if rt.jar is in it, remove it from it. > (i attached the full ant debug output to this message) > > Thanks a lot > Immanuel -- Best regards, Daniel Dekany |
From: <ju...@ig...> - 2009-02-13 17:29:51
|
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 |
From: Daniel D. <dd...@fr...> - 2009-01-20 13:38:02
|
Tuesday, January 20, 2009, 1:36:34 PM, ju...@ig... wrote: > Hey everyone, > > while looking for specific ant functionality, i ran across fmpp. > > I think fmpp could do what i need, but i can't seem to find the docs > one of the features (listed at > http://fmpp.sourceforge.net/index.html#sect2) > > - Bulk file processing: > - Can ignore bad source files and log the error > message into a text file. > > > Can anyone direct me to where it is described ? http://fmpp.sourceforge.net/settings.html#sect18 It's the "stopOnError" setting. > Or tell me what makes a source file 'bad'? In practice, if it's a FreeMarker template that fails during parsing or execution. But AFAIR all kind of file processing errors make the source file "bad". > And is a source file a 'to-pre-processed' file or a config file ? A 'to-pre-processed' file. > The functionality i need is for ant to report when it encounters > a @foo@ reference for which no property is defined. > In other words, i want to prevent leaving any @foo@ references in > the output of a <copy> task. > > Is this something fmpp can do ? FMPP is not working together with the copy task; it's not a filter, it's a standalone stuff. Also, the syntax is ${foo} as that's the syntax of FreeMarker templates. Other than that, the answer is yes. FreeMarker templates don't tolerate broken references, not even null-s, unless you write something like ${possiblyMissingVariable!defaultExpression}. > Thanks a lot > > Immanuel Grégoire -- Best regards, Daniel Dekany |
From: <ju...@ig...> - 2009-01-20 13:10:20
|
Hey everyone, while looking for specific ant functionality, i ran across fmpp. I think fmpp could do what i need, but i can't seem to find the docs one of the features (listed at http://fmpp.sourceforge.net/index.html#sect2) - Bulk file processing: - Can ignore bad source files and log the error message into a text file. Can anyone direct me to where it is described ? Or tell me what makes a source file 'bad' ? And is a source file a 'to-pre-processed' file or a config file ? The functionality i need is for ant to report when it encounters a @foo@ reference for which no property is defined. In other words, i want to prevent leaving any @foo@ references in the output of a <copy> task. Is this something fmpp can do ? Thanks a lot Immanuel Grégoire |
From: Daniel D. <dd...@fr...> - 2007-12-16 22:59:35
|
Download: http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.13.tar.gz or http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.13.zip Changes ------- Bugfixes: * The "skipUnchanged" setting haven't had any effect since 0.9.10. Now it works again. * When detecting the dimensions of certain image files, new lines were printed to the standard output (i.e., to the console). * The "slicedText" data loader has ignored the encoding parameter. * Warning! Incompatible change! The "csv", "text" and "slicedText" data loaders didn't skipped the BOM (byte order mark) character at the beginning of the file. This was a problem as the Windows Notepad inserts a BOM there when it saves with UTF-8 encoding. This fix is not 100% backward compatible, as someone may indeed wanted to have that BOM. * API: The fmpp.dataloaders.AbstractTextDataLoader ignored the encoding returned by the parseExtraArguments method. * API: The fmpp.dataloaders.AbstractTextDataLoader didn't removed the BOM character from the beginning of files. New features, improvements: * The "csv" data loader has a few new options: normalizeHeaders, trimCells, and emptyValue. * Warning! Incompatible change! New setting: "ignoreSvnFiles". This will ignore directories with name ".svn" inside the source root directory. This setting is by default on (true), so it's theoretically not backward compatible. * API: DataLoaderUtil.getStringArrayArgument and getStringArrayOption now have an overload with "allowString" argument, so that a single item can be easily treated as an array of length 1. * Updated freemarker.jar and the included FreeMarker Manual to 2.3.11. * The project has switched from CVS to SVN. The CVS repository is not used anymore. -- Best regards, Daniel Dekany |
From: Daniel D. <dd...@fr...> - 2007-06-22 20:33:42
|
Friday, June 22, 2007, 4:01:20 PM, Juan Larran wrote: > Hello, > > Ive some experience with FreeMarker and recently i started to use > fmpp to generate ftl pages from an xml file. > > Most of the pages used the same tlds and tags libraries, so I tried to use the header configuration. > > The problem that I have its the next one: > > From the file fmpp_list.ftl i generate a lot of pages (ie > product_list_index.ftl, product_list_body.ftl, > product_list_labels.ftl, product_list_ftl, and so for different > entities), when I put a header to **/*_body_list.ftl the fmpp didnt > findd that file and dont put anything. If I put **/*.ftl they put > the header to fmpp_list.ftl but not for the generated files. > > How could I put a header to the generated files? > > I generated the files by the command <@pp.changeOutputFile inside the fmpp_list.ftl I guess you misunderstand the header/footer feature. It puts the header/footer at the top/bottom of the *template* (i.e. FTL) files before FreeMarker parses them. It doesn't directly affect the output. It meant to be used for adding commonly used stuff like <#import ...>-s and <#escape ...>-s to the *templates*, to save key strokes for the template author. But of curse as it can contain arbitrary FTL, it can be used for much more. I suppose you generate multiple output files from a single template in loop. In that case it's trivial to add a common header to each *output* file, as you can specify it inside the loop: <#list ....> <@pp.changeOutputFile ... /> You common header comes here. Other non-header stuff comes here. </#list> Now, if you want to control these common *output* file headers using the FMPP "borders" setting, then you could specify a header there like this: <#macro commonHeader> You common header comes here. It can contain markup, interpolations, directive calls, etc. </#macro> Note again that this will be the header of *templates*. It will define (not execute) a "commonHeader" macro in each templates whose header it is, but it will not output anything yet. Then inside the output file loop you can do this: <#list ....> <@pp.changeOutputFile ... /> <@commonHeader /> <#-- Now it is actually printed --> ... other non-header stuff ... </#list> -- Best regards, Daniel Dekany |
From: Juan L. <jl...@at...> - 2007-06-22 13:58:17
|
Hello, I've some experience with FreeMarker and recently i started to use fmpp to generate ftl pages from an xml file. Most of the pages used the same tlds and tags libraries, so I tried to use the header configuration. The problem that I have it's the next one: >From the file fmpp_list.ftl i generate a lot of pages (ie product_list_index.ftl, product_list_body.ftl, product_list_labels.ftl, product_list_ftl, and so for different entities), when I put a header to **/*_body_list.ftl the fmpp didn't findd that file and don't put anything. If I put **/*.ftl they put the header to fmpp_list.ftl but not for the generated files. How could I put a header to the generated files? I generated the files by the command <@pp.changeOutputFile inside the fmpp_list.ftl Thx a lot Juan |
From: Daniel D. <dd...@fr...> - 2007-04-27 14:41:53
|
Download: http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.12.tar.gz (or http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.12.zip) Changes ------- Bugfixes: * Warning! Incompatible change! In TDD files value types were incorrectly forced to string if they were inside an explicitly defined hash (i.e. inside { and }). Like {x: 1, y: false} was interpreted as {x: "1", y: "false"}, that is, both values were strings. From now it is interpreted correctly, so with the above example x will be the number 1 and y will be the boolean false. New features, improvements: * New data loader: tddSequence for loading a TDD file as a TDD sequence (i.e. list) rather than as a TDD hash (i.e. map). * Updated freemarker.jar to 2.3.10, and bhs.jar (BeanShell) to 2.0b4 in the distribution pack. |
From: Daniel D. <dd...@fr...> - 2006-09-24 14:07:29
|
Sunday, September 24, 2006, 1:52:54 PM, Ralf Hauser wrote: > Daniel, > >> > startTag+ <@err.text["de"]?interpret /> >> (It doesn't cause any difference, but you could just write >> <@err.text.de?interpret />) > Thanks for the hint, bug I guess I cannot use it because in > reality, that "de" also comes from an iterated list variable... > >> > The result is that the "=C3=BC" that were directly in the xml are >> > correctly while the "=C3=BC" that come from the include in the xml a= re >> > distorted. >> So that distorted =C3=BC is directly typed into a FTL file? If so, the= n >> maybe the whole thing has nothing to do with XML, but simply the >> encoding (source encoding) of that FTL is left on the default >> ISO-8859-1, while you have written it as utf-8 in your text editor. >> Either start the FTL files with <#ftl encoding=3D"utf-8">, or set the >> global source-encoding setting of FMPP to utf-8 (be default it is >> ISO-8859-1). > Thanks, I put the <#ftl encoding=3D"utf-8"> as the very first into > the file that does the <#list /> and the problem was gone! > > http://freemarker.org/docs/ref_directive_ftl.html doesn't say > anything about how to do a "global source-encoding setting". It > would be great to have that. Remember I do that out of ant ;) No wonder it's not there, since it's a setting and not a directive, and furthermore it's an *FMPP* setting, not an FreeMarker setting. Anyway, here: "Text encoding issues", http://fmpp.sourceforge.net/settings.html#sect6. > Thanks for the quick reply and regards=20 > > Ralf --=20 Best regards, Daniel Dekany |
From: Ralf H. <ral...@gm...> - 2006-09-24 11:53:08
|
Daniel, > > startTag+ <@err.text["de"]?interpret /> > (It doesn't cause any difference, but you could just write > <@err.text.de?interpret />) Thanks for the hint, bug I guess I cannot use it because in reality, = that "de" also comes from an iterated list variable... > > The result is that the "=C3=BC" that were directly in the xml are > > correctly while the "=C3=BC" that come from the include in the xml = are > > distorted. > So that distorted =C3=BC is directly typed into a FTL file? If so, = then > maybe the whole thing has nothing to do with XML, but simply the > encoding (source encoding) of that FTL is left on the default > ISO-8859-1, while you have written it as utf-8 in your text editor. > Either start the FTL files with <#ftl encoding=3D"utf-8">, or set the > global source-encoding setting of FMPP to utf-8 (be default it is > ISO-8859-1). Thanks, I put the <#ftl encoding=3D"utf-8"> as the very first into the = file that does the <#list /> and the problem was gone! http://freemarker.org/docs/ref_directive_ftl.html doesn't say anything = about how to do a "global source-encoding setting". It would be great to = have that. Remember I do that out of ant ;) Thanks for the quick reply and regards=20 Ralf |
From: Daniel D. <dd...@fr...> - 2006-09-24 10:57:30
|
Sunday, September 24, 2006, 11:30:18 AM, Ralf Hauser wrote: > Hi Dani and list readers, > > An Xml file contains "=C3=BC" in utf-8 encoding. > > Then I do > <#assign dataFile =3D "errors.xml" /> > <#assign e_xml =3D pp.loadData("xml", dataFile)> > > <@pp.setOutputEncoding encoding=3D"utf-8" /> > <@pp.changeOutputFile name=3D"ErrorTexts.java" /> > > Some xml-texts refer to an include, so I do > > <#include "site_defs.de.ftl" /> > > And then > > <#list e_xml.errList.error as err> > > startTag+ <@err.text["de"]?interpret /> (It doesn't cause any difference, but you could just write <@err.text.de?interpret />) > The result is that the "=C3=BC" that were directly in the xml are > correctly while the "=C3=BC" that come from the include in the xml are > distorted. So that distorted =C3=BC is directly typed into a FTL file? If so, then maybe the whole thing has nothing to do with XML, but simply the encoding (source encoding) of that FTL is left on the default ISO-8859-1, while you have written it as utf-8 in your text editor. Either start the FTL files with <#ftl encoding=3D"utf-8">, or set the global source-encoding setting of FMPP to utf-8 (be default it is ISO-8859-1). > Does the <#list /> command loose the encoding? No. > When only including the sd_Reset and directly writing it out into a > file without the <#list, all is fine. > > Any hints? > > Ralf > > Excerpt from the errors.xml: > <error property=3D"no.access.aft.forg.pw" > > <text> > <de>Nach einer \" ${sd_Reset}\", =C3=BCber ...</de> > </text> > > Excerpt from the "site_defs.de.ftl" > > <#assign sd_Reset=3D"R=C3=BCcksetzung" /> > > So the sd_Reset results in "RA1cksetzung" while the "=C3=BCber" in the > same line arrives correctly in my ErrorTexts.java ... Yeah, look like you have forgot to tell to FMPP that the file that contains that assignment uses utf-8, so it has encoded it with ISO-8859-1. --=20 Best regards, Daniel Dekany |
From: Ralf H. <ral...@gm...> - 2006-09-24 09:30:31
|
Hi Dani and list readers, An Xml file contains "=C3=BC" in utf-8 encoding. Then I do <#assign dataFile =3D "errors.xml" /> <#assign e_xml =3D pp.loadData("xml", dataFile)> <@pp.setOutputEncoding encoding=3D"utf-8" /> <@pp.changeOutputFile name=3D"ErrorTexts.java" /> Some xml-texts refer to an include, so I do <#include "site_defs.de.ftl" /> And then <#list e_xml.errList.error as err> startTag+ <@err.text["de"]?interpret /> The result is that the "=C3=BC" that were directly in the xml are = correctly while the "=C3=BC" that come from the include in the xml are = distorted. Does the <#list /> command loose the encoding? When only = including the sd_Reset and directly writing it out into a file without = the <#list, all is fine. Any hints? Ralf Excerpt from the errors.xml: <error property=3D"no.access.aft.forg.pw" > <text> <de>Nach einer \" ${sd_Reset}\", =C3=BCber ...</de> </text> Excerpt from the "site_defs.de.ftl" <#assign sd_Reset=3D"R=C3=BCcksetzung" /> So the sd_Reset results in "R=C3=83=C2=BCcksetzung" while the = "=C3=BCber" in the same line arrives correctly in my ErrorTexts.java ... |
From: Daniel D. <dd...@fr...> - 2006-07-19 08:57:49
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><title></title> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-= 1"> <meta http-equiv=3D"Content-Style-Type" content=3D"text/css"> <style type=3D"text/css"><!-- body { margin: 5px 5px 5px 5px; background-color: #ffffff; } /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Text Styles =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D */ hr { color: #000000} body, table /* Normal text */ { font-size: 9pt; font-family: 'Courier New'; font-style: normal; font-weight: normal; color: #000000; text-decoration: none; } span.rvts1 /* Heading */ { font-size: 10pt; font-family: 'Arial'; font-weight: bold; color: #0000ff; } span.rvts2 /* Subheading */ { font-size: 10pt; font-family: 'Arial'; font-weight: bold; color: #000080; } span.rvts3 /* Keywords */ { font-size: 10pt; font-family: 'Arial'; font-style: italic; color: #800000; } a.rvts4, span.rvts4 /* Jump 1 */ { font-size: 10pt; font-family: 'Arial'; color: #008000; text-decoration: underline; } a.rvts5, span.rvts5 /* Jump 2 */ { font-size: 10pt; font-family: 'Arial'; color: #008000; text-decoration: underline; } span.rvts6 { font-size: 11pt; font-family: 'tahoma'; font-weight: bold; color: #ffffff; } span.rvts7 { font-size: 11pt; font-family: 'arial'; } span.rvts8 { font-size: 11pt; font-family: 'tahoma'; } span.rvts9 { font-size: 8pt; font-family: 'arial'; font-style: italic; color: #c0c0c0; } /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Para Styles =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D */ p,ul,ol /* Paragraph Style */ { text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; } .rvps1 /* Centered */ { text-align: center; } --></style> </head> <body> <p>Wednesday, July 19, 2006, 8:10:41 AM, Colbert Philippe wrote:</p> <p><br></p> <div><table border=3D0 cellpadding=3D1 cellspacing=3D2 style=3D"border-co= lor: #000000; border-style: solid; background-color: #ffffff;"> <tr valign=3Dtop> <td width=3D14 style=3D"background-color: #0000ff;"> <p><span class=3Drvts6>></span></p> </td> <td width=3D547> <p><span class=3Drvts7>We know that we can loop on List in the TDD file (= i..e someList : [ ...items...]) using the <#list ....> command. &nb= sp;</span></p> <p><span class=3Drvts8> </span></p> <p><span class=3Drvts7>Can we loop on Map in the TDD file in the order it= appears in the TDD file? There is a strong need for this. = Looping through entries of a map, we could get access to the key and valu= e of each entry (i.e. entry.key and entry.value)?</span></p> <p><span class=3Drvts8> </span></p> <p><span class=3Drvts7>Java allows for looping through Map but the order = is not respected. I don't know if such Map exists. The progr= ammer might have to code a Map as a List<Entry> in order to achieve= this.</span></p> </td> </tr> </table> </div> <p><br></p> <p>Listing maps is possible using the myMap?keys or myMap?values in FreeM= arker, however, as you said, it doesn't keep the order as the entires wer= e added. It could be fixed by replacing HashMap with LinkedHashMap in the= TDD implementation. The problem is that LinkedHashMap was added in J2SE = 1.4 only (incredible, isn't it?)... So if I use that, maps will not be or= dered if you use J2SE 1.3 or 1.2, and that's confusing. Or FMPP has to re= quire at least J2SE 1.4. Or do somebody know about a J2SE 1.2 compatible = free LinkedHashMap implementation that extends HashMap? I haven't found a= ny...</p> <p><br></p> <p><span class=3Drvts9>-- </span></p> <p><span class=3Drvts9>Best regards,</span></p> <p><span class=3Drvts9> Daniel Dekany</span></p> </body></html> |
From: Colbert P. <col...@ro...> - 2006-07-19 06:09:38
|
We know that we can loop on List in the TDD file (i..e someList : [ = ...items...]) using the <#list ....> command. =20 Can we loop on Map in the TDD file in the order it appears in the TDD = file? There is a strong need for this. Looping through entries of a = map, we could get access to the key and value of each entry (i.e. = entry.key and entry.value)? Java allows for looping through Map but the order is not respected. I = don't know if such Map exists. The programmer might have to code a Map = as a List<Entry> in order to achieve this. |
From: Daniel D. <dd...@fr...> - 2006-07-18 20:31:17
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><title></title> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-= 1"> <meta http-equiv=3D"Content-Style-Type" content=3D"text/css"> <style type=3D"text/css"><!-- body { margin: 5px 5px 5px 5px; background-color: #ffffff; } /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Text Styles =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D */ hr { color: #000000} body, table /* Normal text */ { font-size: 9pt; font-family: 'Courier New'; font-style: normal; font-weight: normal; color: #000000; text-decoration: none; } span.rvts1 /* Heading */ { font-size: 10pt; font-family: 'Arial'; font-weight: bold; color: #0000ff; } span.rvts2 /* Subheading */ { font-size: 10pt; font-family: 'Arial'; font-weight: bold; color: #000080; } span.rvts3 /* Keywords */ { font-size: 10pt; font-family: 'Arial'; font-style: italic; color: #800000; } a.rvts4, span.rvts4 /* Jump 1 */ { font-size: 10pt; font-family: 'Arial'; color: #008000; text-decoration: underline; } a.rvts5, span.rvts5 /* Jump 2 */ { font-size: 10pt; font-family: 'Arial'; color: #008000; text-decoration: underline; } span.rvts6 { font-size: 11pt; font-family: 'tahoma'; font-weight: bold; color: #ffffff; } span.rvts7 { font-family: 'arial'; } span.rvts8 { font-size: 11pt; font-family: 'tahoma'; } span.rvts9 { font-size: 8pt; font-family: 'arial'; font-style: italic; color: #c0c0c0; } span.rvts10 { font-size: 13pt; } /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Para Styles =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D */ p,ul,ol /* Paragraph Style */ { text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; } .rvps1 /* Centered */ { text-align: center; } --></style> </head> <body> <p>Tuesday, July 18, 2006, 8:26:36 PM, Colbert Philippe wrote:</p> <p><br></p> <div><table border=3D0 cellpadding=3D1 cellspacing=3D2 style=3D"border-co= lor: #000000; border-style: solid; background-color: #ffffff;"> <tr valign=3Dtop> <td width=3D14 style=3D"background-color: #0000ff;"> <p><span class=3Drvts6>></span></p> </td> <td width=3D547> <p><span class=3Drvts7>SUGGESTION: Make a two-level TDD file structure fo= r more abstraction power.</span></p> <p><span class=3Drvts8> </span></p> <p><span class=3Drvts7>The TDD feature is one of the most powerful featur= es of FMPP. TDD hierarchical structure lends itself to complex appl= ications. That's great!</span></p> <p><span class=3Drvts8> </span></p> <p><span class=3Drvts7>However, I find myself wanting a little bit more. = I would like to see a two-level TDD file setup. That is I wa= nt to see two (2) different TDD files. The values of the first TDD = file beeing used in the second TDD file (property interpolation) and the = second TDD being the final TDD file to be used with FMPP.</span></p> <p><span class=3Drvts8> </span></p> <p><span class=3Drvts7>This would greatly increase the power of FMPP. &nb= sp; It's a natural extensition. For instance, my application simply= create XML configuration files using FMPP. I have wrapped each re= usable XML section into an FMPP macro. So values are replaced direc= tly into the macro. My TDD file separates parameters by macros. &n= bsp; I would need a second TDD file to have "application specific concept= abstraction". That is grouping values by application concepts. &n= bsp; This second two-level concept can be reused in any application and w= ould make things easier and cleaner.</span></p> <p><span class=3Drvts8> </span></p> <p><span class=3Drvts7>Let me go even one step further by generalizing th= is concept of levels of TDD file. Let me suggests that FMPP suppor= ts any number of cascading TDD files. Instead of limiting ourselves= to two-leve, let's make it n-level TDD file cascading.</span></p> <p><span class=3Drvts8> </span></p> <p><span class=3Drvts7>TDD file1 --> TDD file 2 --> ... TDD file N = ---> Used by FMPP</span></p> <p><span class=3Drvts8> </span></p> <p><span class=3Drvts7>The TDD file N is used by FMPP. The other f= iles are forgotten. This would allow any number of levels of abstr= action.</span></p> <p><span class=3Drvts8> </span></p> <p><span class=3Drvts7>Colbert Philippe</span></p> </td> </tr> </table> </div> <p><br></p> <p>Good-old TDD bleeds from hundreds of wounds, huh? For example, what yo= u say, if I understand your suggestion well at least, is a "deficiency" t= hat is known for me. It should be solved purely on the TDD level. The TDD= should have a line like:</p> <p><br></p> <p> %substitutions: {tdd(data/whatever.tdd)}</p> <p> # Note that of course you could use cvs(...) and whatnot= .</p> <p><br></p> <p>and then the TDD language should allow referring to these variables so= mehow... don't know, for example with a sub(name) function. (Similarly, t= he inheritance that TDD config files can do, should be a TDD feature, not= an FMPP config. loader feature.) Or you even wanted macro calls in the T= DD file? This is how a simple config. file format could gradually become = a 2nd programming language... :)</p> <p><br></p> <p>Now, I don't develop FMPP actively for while, as it is clearly stated = on the index page as well. So, if you (or anybody) needs new features (as= opposed to bugfixes, that I still do), I'm open to discuss proposals tha= t then can be followed with proper quality patches. Or even giving admin = rights to the project, if I find the person reliable and talented. Otherw= ise all I can say, that if I will ever write a next generation preprocess= or tool (Is there a real demand for a such tool? I'm not sure...), I won'= t forget about these things.</p> <p><br></p> <p><span class=3Drvts9>-- </span></p> <p><span class=3Drvts9>Best regards,</span></p> <p><span class=3Drvts9> Daniel Dekany</span></p> </body></html> |
From: Colbert P. <col...@ro...> - 2006-07-18 18:26:04
|
SUGGESTION: Make a two-level TDD file structure for more abstraction = power. The TDD feature is one of the most powerful features of FMPP. TDD = hierarchical structure lends itself to complex applications. That's = great! However, I find myself wanting a little bit more. I would like to see = a two-level TDD file setup. That is I want to see two (2) different TDD = files. The values of the first TDD file beeing used in the second TDD = file (property interpolation) and the second TDD being the final TDD = file to be used with FMPP. This would greatly increase the power of FMPP. It's a natural = extensition. For instance, my application simply create XML = configuration files using FMPP. I have wrapped each reusable XML = section into an FMPP macro. So values are replaced directly into the = macro. My TDD file separates parameters by macros. I would need a = second TDD file to have "application specific concept abstraction". = That is grouping values by application concepts. This second two-level = concept can be reused in any application and would make things easier = and cleaner. Let me go even one step further by generalizing this concept of levels = of TDD file. Let me suggests that FMPP supports any number of = cascading TDD files. Instead of limiting ourselves to two-leve, let's = make it n-level TDD file cascading. TDD file1 --> TDD file 2 --> ... TDD file N ---> Used by FMPP The TDD file N is used by FMPP. The other files are forgotten. This = would allow any number of levels of abstraction. Colbert Philippe |
From: Bruce P. <bpe...@ya...> - 2006-07-12 15:31:09
|
Great suggestion! Implementing your suggestion revealed trailing whitespace in the keys. Removing the whitespace solved the problem. Thanks a lot for your help and your great insight! Daniel Dekany <dd...@fr...> wrote: I doesn't see any problem with this... so it's probably that GHI really doesn't have an entry with "A1" key, or that "A1" is mapped to a Java null value (that way the value is missing despite that the key exists). What do you see if you list the hash entries like: <#list ABC.DEF.GHI?keys as k> ${k} => ${ABC.DEF.GHI[k]?default('Java null')} </#list> Wednesday, July 12, 2006, 3:41:22 AM, Bruce Perryman wrote: > OK, I'm doing something wrong, again. This is the structure of my maps: ABC || =>DEF || =>GHI || =>A1=a =>A2=b =>A3=c =>GHI2 || =>B1=d =>B2=e =>B3=f Hopefully this description makes sense to you. ABC contains a map DEF and DEF contains a few maps, two of which are GHI, and GHI2. I am trying to evaluate A1 at the GHI level. This I do as follows: ${ABC.DEF.GHI.A1} This results in the error that A1 is undefined. If I evaluate ${ABC.DEF.GHI} the error is that a string, etc. is expected but the expression evaluates to a simple hash. Can you please point me in the right direction? Ultimately, I want to be able to use a variable to represent the GHI level with something like: ${ABC.DEF[x].A1} But I thought I'd work with the 'simple' case first. Thanks in advance for your help. -- Best regards, Daniel Dekany --------------------------------- Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail Beta. |