Skip to content

Commit

Permalink
Fix missing packages & update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Oct 22, 2018
1 parent 995f240 commit 1b452ab
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 37 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# freemarker-parser

[![CircleCI](https://circleci.com/gh/armano2/freemarker-parser/tree/master.svg?style=svg)](https://circleci.com/gh/armano2/freemarker-parser/tree/master)
[![Coverage Status](https://codecov.io/gh/armano2/freemarker-parser/branch/master/graph/badge.svg)](https://codecov.io/gh/armano2/freemarker-parser)
[![Greenkeeper badge](https://badges.greenkeeper.io/armano2/freemarker-parser.svg)](https://greenkeeper.io/)
[![Codecov](https://img.shields.io/codecov/c/github/armano2/freemarker-parser.svg?style=for-the-badge)](https://circleci.com/gh/armano2/freemarker-parser/tree/master)
[![CircleCI](https://img.shields.io/circleci/project/github/armano2/freemarker-parser/master.svg?style=for-the-badge)](https://circleci.com/gh/armano2/freemarker-parser/tree/master)
[![License](https://img.shields.io/github/license/armano2/freemarker-parser.svg)](https://github.com/armano2/freemarker-parser/blob/master/LICENSE.md)
[![Greenkeeper](https://badges.greenkeeper.io/armano2/freemarker-parser.svg)](https://github.com/armano2/freemarker-parser/blob/master/LICENSE.md)
[![npm](https://img.shields.io/npm/v/freemarker-parser.svg)](https://www.npmjs.com/package/freemarker-parser)

Freemarker Parser is a javascript implementation of the Freemarker (http://freemarker.sourceforge.com).

This project contains experimental version of parser ftl to ast tree
This project contains **experimental version** of parser ftl to ast tree

## Installation
You can install `freemarker-parser` using [npm](https://npmjs.com):
Expand All @@ -18,12 +20,8 @@ $ npm install freemarker-parser --save-dev
## Usage
Require `freemarker-parser` inside of your JavaScript:

```js
const freemarker = require("freemarker-parser");
```

### Parser
```freemarker
```ftl
<#assign f=1>
<#if f gt 0>
Expand All @@ -34,17 +32,20 @@ const freemarker = require("freemarker-parser");
```

```js
const freemarker = require("freemarker-parser")

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

console.log(astTree)
console.log(data.ast)
console.log(data.tokens)
```

## Currently supported:
- interpolations `${foo}`
- methods, i.e. `${avg(3, 5)}`
- executing macro
- directives:
- directives: http://freemarker.sourceforge.net/docs/ref_directives.html
- `#attempt`
- `#recover`
- `#assign`
Expand Down Expand Up @@ -80,7 +81,7 @@ console.log(astTree)
- support default values, i.e. `${user!"Anonymous"}`
- null resistance in above expressions if in parenthesis
- alternative syntax if starts with `[#ftl]`
- directives: http://freemarker.sourceforge.net/docs/ref_directives.html
- directives:
- `#escape`
- `#noescape`
- `#fallback`
Expand Down
19 changes: 3 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "freemarker-parser",
"version": "1.0.1",
"version": "1.1.2",
"description": "Freemarker Parser is a javascript implementation of the Freemarker",
"scripts": {
"build": "npm run lint & tsc",
Expand Down Expand Up @@ -29,33 +29,31 @@
"node": ">=6.0.0"
},
"author": "Armano (https://github.com/armano2)",
"license": "Apache-2.0",
"license": "MIT",
"bugs": {
"url": "https://github.com/armano2/freemarker-parser/issues"
},
"main": "index.js",
"main": "dist/index.js",
"files": [
"index.d.ts",
"index.js",
"index.js.map"
"dist/*.d.ts",
"dist/*.js"
],
"homepage": "https://github.com/armano2/freemarker-parser#readme",
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/json-stringify-safe": "^5.0.0",
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.0",
"codecov": "^3.1.0",
"glob": "^7.1.3",
"mocha": "^5.2.0",
"mocha-junit-reporter": "^1.18.0",
"nyc": "^13.1.0",
"source-map-support": "^0.5.9",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"typescript": "^3.1.3"
},
"dependencies": {
"debug": "^4.1.0",
"lines-and-columns": "^1.1.6"
},
"nyc": {
Expand Down

0 comments on commit 1b452ab

Please sign in to comment.