How to use the mustache/mustache.to_html function in mustache

To help you get started, we’ve selected a few mustache examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jkvor / tempo / socket.js View on Github external
exports.channel_sub = function(conn, instance, channel_obj) {
  var split = channel_obj.toString().split(':');
  var channel_raw = split[split.length-1];
  var channel_name = 'stats.' + channel_raw;
  console.log("init channel: " + channel_name);
  var view = {
    name: channel_raw,
    label: channel_name
  };
  conn.write(JSON.stringify({"channel": channel_raw, "command": "init", "html": Mu.to_html(canvas_template, view)}));
  if(cache[channel_raw] == undefined)
    cache[channel_raw] = new Array();
  if(subscriptions[channel_name] == undefined) {
    subscriptions[channel_name] = new Array();
    redis.subscribe(channel_name, function(msg) {
      exports.route_msg(instance, channel_raw, msg);
    });
  }
  subscriptions[channel_name].push(conn);
  return channel_raw;
};
github jkvor / tempo / server.js View on Github external
} else {
      var auth = exports.decodeBase64(request.headers['authorization']);
      if (!auth || !auth.username || auth.password != tempo_password) {
        response.writeHead(401, {'WWW-Authenticate': 'Basic realm="Secure Area"'});
        response.end();
        return;
      }
    }
    var instance = request.url.substring(1, request.url.length);
    var view = {
      ws_host: websocket_host,
      ws_port: websocket_port,
      instance: instance
    };
    response.writeHead(200, {'Content-Type': 'text/html'});
    response.end(Mu.to_html(index_template, view));
  } else {
    response.writeHead(404, {'Content-Type': 'text/html'});
    response.end('Not Found\n');
  }
}).listen(http_port, "0.0.0.0");
github cockpit-project / cockpit / pkg / lib / mustache.js View on Github external
to_html: function to_html(template, view, partials, send) {
        if (!view)
            view = {};

        return translate(orig_mustache.to_html(template, view, partials, send));
    },
    clearCache: function clearCache() {