Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing Freemarker templates with Javascript

Has anyone parsed Freemarker templates using Javascript or is there any JS library which does this?

I have a bunch of freemarker templates, I call an API which will return JSON data, now I want to parse freemarker template using JS and replace variables with these values.

As there are some iterative blocks and other logic in templates, parsing is not going to be easy if I write own parser in JS.

Please guide.

like image 609
Harsha Avatar asked Dec 31 '25 00:12

Harsha


1 Answers

I've looked for something similar for my projects, but no such thing exists. The idea of a cross-platform templating language is a recent one and the most commonly used one is mustache.js.

Considering that Freemarker replies heavily on Java along with its macros and intricate file inclusions I think this would be a really hard parser to write.

like image 169
Art Avatar answered Jan 02 '26 13:01

Art