Quick Start
This is the documentation for 1.3.2 version, which is not the latest version. Consider upgrading to 3.4.0.
Using node.js
In some js file:
const rosaenlgPug = require('rosaenlg'); console.log( rosaenlgPug.renderFile('testNLG.pug', { language: 'en_US', data: ['apples', 'bananas', 'apricots'] }) );
In a testNLG.pug
file:
p eachz fruit in data with { separator: ',', last_separator: 'and' } | #{fruit}
This will output <p>Apples, bananas and apricots</p>
.
Using Docker
With fruits.pug
on your local filesystem:
- var data = ['apples', 'bananas', 'apricots', 'pears']; p eachz fruit in data with { separator: ',', last_separator: 'and', begin_with_general: 'I love', end:'!' } | #{fruit}
On your local command line:
$ cat fruits.pug | docker run -i registry.gitlab.com/rosaenlg-projects/docker-rosaenlg -l en_US
You should obtain <p>I love apples, bananas, apricots and pears!</p>
.
For more advanced usages, read Docker RosaeNLG documentation:
-
render files that contain
include
(which is very common) -
watch for templates files changes and render them continuously