kaola-fed / freemarker Goto Github PK
View Code? Open in Web Editor NEWFreemarker integration for NodeJS
License: MIT License
Freemarker integration for NodeJS
License: MIT License
I try to render an Oracle Commerce Cloud email template who contain custom function.
Here is an example of Oracle Template:
${getString("PASSWORD_RESET_SALUTATION", data.firstName)}
<#if data.login?has_content>
${getString("ACCOUNT_EXIST_LINE")} <b>${data.login}</b><br>
</#if>
Any way to create the "getString" function ?
Hey,
the version of freemarker used by this module is outdated. Current version on freemarker.apache.org is 2.3.28, the version of this module is 2.3.21.
This may appear as not that big of a difference, but for example loop variable builtins have been introduced with 2.3.23.
Is there a way to update the freemarker version used?
When I am sending a code to render
method is working fine but when the entry is a file, I got the below error message:
>>> ABORTED! <<<
The cause of aborting was:
java.io.IOException (at fmpp.Engine.process:502): The source file (/private/va-
r/folders/qn/8g5mkrmj7x37ffhmv2syq14c0000gn/T/__temp__f5941c51ca5d56e5e343f867-
413d98b271adad9f.ftl) is not inside the source root
(/Users/[**project_root**])
Why is necessary to create a tmp file to process the code?
I have freemarker template with getter-functions like ${jsonObject.getCreatedAt()} but it seems like not visible in Freemarker.
This is the error i get:
Error: the string ">>> ABORTED! <<<\n\nThe cause of aborting was: \nFreeMarker template error: The following has evaluated to null or missing:\n==> jsonObj.getCreatedAt [in template \"__testMail.ftl\" at line 8, column 7]\n\n----\nTip: It's the step after the last dot that caused this error, not those before it.\n----\nTip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??\n----\n\n----\nFTL stack trace (\"~\" means nesting-related):\n\t
Is there a way to access those functions?
Not exactly an issue but just a missing piece of information in the documentation. Could you please add the version of the FreeMarker that this tool currently supports with each release. Or at least what the current version is in case you guys aren't planning to continue supporting the project.
Great work btw! Just used this for a sandbox app I was working on.
when importing a FTL file using import keyword, this freemarker library does not recognize that the global variable, which are already accessible within the host file, shall be accessible within imported file as well.
for example, below host file can access currentObject as global variable, but the same global variable can NOT be accessed within imported file "utilities.ftl".
host.ftl
<#assign metadata = currentObject.attributes.meta! >
<#assign attributes = currentObject.attributes!>
<#import "../../macros/utilities.ftl" as utilities>
<#include "../../components/identity.ftl" >
utilities.ftl
<#assign roles= currentObject.attributes.roles>
Error: >>> ABORTED! <<<
The cause of aborting was:
FreeMarker template error: The following has evaluated to null or missing:
==> currentObject [in template "macros/utilities.ftl" at line 9, column 22]
FTL stack trace ("~" means nesting-related):
- Failed at: #assign rolesData = currentObject.att... [in template "macros/utilities.ftl" at line 9, column 1]
- Reached through: #import "../../macros/utilities.ftl" ... [in template "components/identity.ftl" at line 1, column 1]
- Reached through: #include "../../compone... [in template "test/react-tests/__temp__identity-test.ftl" at line 12, column 1]
Hi. We're using your library to preview html email templates. A small stack that we feed with some json data and out comes the html email in a browser. This works great.
However, a new requirement came up and we have to actually include partials in various templates.
The way I see it, when we put a <#include "foo.ftl">
in a template, it simply remains exactly that string - it doesn't get evaluated and the contents of foo.tpl don't get included.
Effectively, we can preview each partial on its own, but we can not preview the composed email template.
Without going into details - should this be possible, and we just need to setup our stack better? Or is it maybe just not possible without using actual java freemarker?
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.