RingoJS

Module ringo/mustache

CommonJS-compatible mustache.js module.

This version of mustache.js adds filters. If a tag or section name consists of several space-separated items, the items are evaluated one at a time, starting with the right-most item. If an item evaluates to a function, the result of the previous item is passed to it as argument.

Example

var template = 'Hello {{upper world}}!';
var data = {
    upper: function(str) { return str.toUpperCase() },
    world: 'world'
};
mustache.to_html(template, data);
// -> 'Hello WORLD!'

See

http://github.com/janl/mustache.js
http://github.com/hns/mustache.js

Functions

Properties


name

The name of this module.


to_html (template, data)

Renders template using data as context object.

Parameters

String template

the template.

Object data

the data object.

Returns

String

the formatted text.


version

The version of this module.