Playing with Node.js modules: node-pate

Pâté is a simple XPath-oriented, express-compatible template engine for Node.js

Usage


var pate = require('node-pate');
var formatter = require('./format_lib.js');
var options = {
tpl: '{{ bread/@name }} price: $[[ formatMoney({{ bread/@price }}) ]] ([[ moneyToWords({{ bread/@price }}) ]])',
xml: '<data><row><bread name="Bretzel" price="42.56" /></row></data>',
xpath: '/*/*',
format_lib: formatter
};
pate.parse(options, function (err, data) {
console.log(data);
});

Output:


Bretzel price: $42.56 (CUARENTA Y DOS PESOS CON 56/100)

Source code:


https://github.com/benoror/node-pate

NPM:


https://https://www.npmjs.com/package/node-pate