Socket
Socket
Sign inDemoInstall

freemarker-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    freemarker-parser

Freemarker Parser is a javascript implementation of the Freemarker


Version published
Weekly downloads
597
increased by41.13%
Maintainers
1
Install size
228 kB
Created
Weekly downloads
 

Readme

Source

freemarker-parser

Codecov License npm

Freemarker Parser is a javascript implementation of the Freemarker (https://freemarker.apache.org).

This project contains experimental version of parser ftl to ast tree

Installation

You can install freemarker-parser using npm:

$ npm install freemarker-parser --save-dev

Usage

Require freemarker-parser inside of your JavaScript:

Parser

<#assign f=1>

<#if f gt 0>
  ${f} > 0
<#else>
  ${f} < 0
</#if>
const freemarker = require('freemarker-parser');

const parser = new freemarker.Parser();
const data = parser.parse(template);

console.log(data.ast);
console.log(data.tokens);

Parser (bracket style)

[#assign f=1]

[#if f gt 0]
  ${f} > 0
[#else]
  ${f} < 0
[/#if]
const freemarker = require('freemarker-parser');

const parser = new freemarker.Parser();
const data = parser.parse(template, {
  useSquareTags: true,
  parseLocation: true,
});

console.log(data.ast);
console.log(data.tokens);

Currently supported:

TODO:

  • directives:
    • #fallback
    • #nested
    • #recurse
    • #visit

Keywords

FAQs

Last updated on 22 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc