Giter Site home page Giter Site logo

kaola-fed / freemarker Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 17.0 5.05 MB

Freemarker integration for NodeJS

License: MIT License

FreeMarker 0.22% JavaScript 0.07% Shell 0.03% Batchfile 0.06% HTML 93.12% CSS 0.27% C 0.01% Java 6.14% Logos 0.01% Yacc 0.01% C++ 0.01% Roff 0.01% Less 0.07% Fluent 0.01% Assembly 0.01%

freemarker's People

Contributors

davizp avatar imhype avatar int64ago avatar jonfrost43 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

freemarker's Issues

Create custom function "getString"

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")}&nbsp; &nbsp; <b>${data.login}</b><br>
</#if>

Any way to create the "getString" function ?

Outdated freemarker version

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?

The source file is not inside the source root

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?

Cannot access functions of JSON objects in freemarker

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?

Versioning of FreeMarker

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.

this library does NOT support global variable access within the imported file

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]


Tip: 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 st
ep of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??


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]

Include partials

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.