freemarker / fmpp Goto Github PK
View Code? Open in Web Editor NEWCommand line and Ant tool for processing files with FreeMarker
Home Page: http://fmpp.sourceforge.net/
License: Other
Command line and Ant tool for processing files with FreeMarker
Home Page: http://fmpp.sourceforge.net/
License: Other
http://fmpp.sourceforge.net/dataloader.html#key_antProperites
properyName1
, properyName2
, properyNameN
should be spelled "property"
Also this phrase (emphasis mine):
Parameters that refer to not existing Ant properties will be silently ignored
Should be:
Parameters that refer to non-existing Ant properties will be silently ignored
fmpp can check if the produced contents is identical to the previous file. In that case fmpp can skip rewriting the destination file, thus saving time for the consumers. The next build steps could see that "no modification was performed", thus recompilation/repackaging is not required.
This does not require <#include/<#import analysis and it will speed up builds that include fmpp steps.
fmpp can compute the set of imported files and their timestamps when processing the template. Thus at the subsequent build, it could check the actual timestamps and reprocess the file if imported file is updated.
Of course both approaches would fail in face of templates that create/modify/delete files when they execute, however I believe it is sad fmpp can't handle the typical cases gracefully.
It should be possible to configure freemarker to use the old #-less syntax.
However, to give users time to prepare for this change, in FreeMarker 2.1 and 2.2 the usage of # is optional, unless the programmer enables strict syntax mode in the FreeMarker configuration by calling setStrictSyntaxMode(true) on Configuration. In fact, we strongly recommend this to programmers. Starting from some later release this setting will be initially set to true. Also, you can specify if you want to use strict syntax or old syntax in the template files with the ftl directive.
How can I configure the fmpp preprocessor to use this old syntax with the Ant integration? Is there a setting or how can one call setStrictSyntaxMode(false)?
I am grateful for any assistance!
For the following FM file
<#if value??>
not null
<#else>
is null
</#if>
I'm trying to render it using JSON data {"value": null}
. My config is following
data: {"value":null}
When I run the command
$ ./fmpp test.ftl -C config -o output
the output is not null
. Checking the code, I believe null gets wrapped to JSONNullNode (https://github.com/freemarker/fmpp/blob/master/src/main/java/fmpp/models/JSONNode.java#L89) as value?is_node
returns true. If I test the same code directly in freemarker (using https://try.freemarker.apache.org/) it gets evaluated to is null
.
Is this a bug or expected behaviour? Should I load JSON differently?
Do you know how to provide date-like data in TDD? I try ISO string but it is recognised as plain String and not as a hash.
Hi,
I'm new to FMPP and I'm trying to have it render a single XML document to a very basic one-liner text file. Templating does work as expected, except regarding the XInclude feature: I can't make FMPP apply the transclusion. In the called template, browsing the DOM with pp.doc
returns an xi:include
element instead of the target one.
XInclude does work when used with static XML data sources (defined in the main config file), but not with dynamic XML rendering. I use the latest version. What did I forget ?
recommendedDefaults: 0.9.16
sourceRoot: /home/marin/fmpp/in
outputRoot: /home/marin/fmpp/out
dataRoot: /home/marin/fmpp/data
modes : [
ignore(/templates/)
]
data: {
# Works fine: <xi:include> elements are processed.
works: xml(music/works/bach/bwv622.xml, {'xincludeAware': true})
}
xmlRenderings: [
{
# Does NOT work: <xi:include> elements are returned as-is.
ifDocumentElementIs: release
template: templates/release.tags
xincludeAware: true
xmlns: {D: http://www.w3.org/1999/xhtml, xi: http://www.w3.org/2001/XInclude}
}
]
<release xmlns="http://www.w3.org/1999/xhtml"
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>My release</title>
<performances>
<performance>
<work>
<xi:include href="/home/marin/fmpp/data/music/works/bach/bwv622.xml" parse="xml"/>
</work>
</performance>
</performances>
</release>
<#ftl ns_prefixes={"D":"http://www.w3.org/1999/xhtml"}>
<@pp.renameOutputFile extension="txt" />
<#assign release = pp.doc.release>
<#list release.performances.performance.work.* as c>
- ${c?node_name}
</#list>
- include
Instead of the the root element from "/home/marin/fmpp/data/music/works/bach/bwv622.xml".
Is it possible to update this to the most recent version of freemarker?
I tried to build the project locally, so I could submit a diff, but could not get my environment setup.
Thanks,
Cory
I tried fmpp like
fmpp test/template/index.ftl > index.html
but got following result
Failed!
The "outputRoot" setting was not set. FMPP can't start working without that.
I think , the outputRoot
must be a Optional arguments to help developer use stdout in other way . like text processing.
Just a suggestion.
Hello. First, thanks for maintaining this project!
Second, I'd like to apologize for bringing up something that was done Twelve years ago ๐
I'm interested in FreeMarker's Localized Lookup functionality. Can we turn this on?
Within the FMPP Engine.java file, line 301:
fmCfg.setLocalizedLookup(false);
I was wondering what the "confusing effects" referenced in the change log would be if I set that to true
.
Thank you!
When I try to load json from http://fmpp.sourceforge.net/dataloader.html#key_json I get following error:
[ERROR] Failed to execute goal com.googlecode.fmpp-maven-plugin:fmpp-maven-plugin:1.1:generate (generate-mailboxes) on project mailboxes-configuration: Failed to apply the value of the "data" setting.
[ERROR]
[ERROR] Caused by:
[ERROR] TDD error: Function doesn't evalute to a Map, but to fmpp.models.JSONArrayNode, so it can't be merged into the hash.
[ERROR] Error location: line 1, column 1:
[ERROR] json(../data/mailboxes-data.txt, UTF-8)
[ERROR] ^
Can anyone try to reproduce it?
I would like to be able to define the following in config.fmpp:
freemarkerAutoIncludes: [
/path/to/global.ftl,
/path/to/footer-tools.ftl
]
I would expect this to result in a call to Configuration.setAutoIncludes().
Parsing of a javascript object fails if a name isn't specified with it.
config.fmpp: (produces error)
sources:infile.orig.html
outputFile:outfile.html
data:{json(/root/fmpp_test_bug/esa_alert.json)}
config.good.fmpp: (this succeeds with name of vars and modified source file to use this)
sources:infile.mod.html
outputFile:outfile.html
data:{vars: json(/root/fmpp_test_bug/esa_alert.json)}
The error produced is:
Note: Using the config.fmpp in the working directory.
Failed!
Failed to apply the value of the "data" setting.
Caused by:
TDD error: Function doesn't evalute to a Map, but to fmpp.models.JSONObjectNode, so it can't be merged into the hash.
Error location: line 3, column 7 in /root/fmpp_test_bug/config.fmpp:
data:{json(/root/fmpp_test/esa_alert.json)}
This is using FMPP version 0.9.15.
I will send the assignee source files offline.
The templates i'm working on are written with square brackets.
In the configuration, I'm therefore configuring fmpp to use square brackets using this configuration item
tagSyntax : "squareBracket"
The template is correctly interpreted and converted.
The problem is when I want to inject datamodel using tdd file.
In such a case, the datamodel is inserted in the ftl template using <#assign> directives, with angle brackets, and the data is not interpreted as good freemarker directive.
My template
[#assign myDirective = 'title' /]
<h1>${myDirective}</h1>
Data model
dataObject = {
"key1" : "string value"
};
Result
<#assign key1 = "string value"/>
<h1>title</h1>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.