How to use the 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 jbakse / comb_script / src / javascript / docs.js View on Github external
if (type.extends && language.regionTypes[type.extends]) {
			type.inherited_properties = language.regionTypes[type.extends].properties;
		}
	});

	// find, render, and inject the menu template
	var menuTemplate = $('#template-menu').html();
	Mustache.parse(menuTemplate); // optional, speeds up future uses
	var menuRendered = Mustache.render(menuTemplate, data);
	$('#template-menu').html(menuRendered);


	// find, render, and inject the region-type api template
	var template = $('#template-regionTypes').html().replace(/>/g, ">");
	var propertyTemplate = $('#template-property').html();
	var rendered = Mustache.to_html(template, data, {prop: propertyTemplate});
	$('#template-regionTypes').html(rendered);


	//enable property clicking
	$(".property-name").css("cursor", "pointer");
	$(".properties.inherited-properties li").addClass("closed");

	$(".property-name").click(
		function() {
			$(this).parent().toggleClass("closed");
		}
	);
}
github jrm2k6 / dynamic-json-resume / cli.js View on Github external
fs.readFile(__dirname + _cssFile, 'utf-8', function(err, data) {
              if (err) {
                console.log(err);
                process.exit(1);
              }

              var head = "<style>" + data + "</style>";
              templateContent = head + templateContent;
              var html = mustache.to_html(templateContent, {
                "resume": resumeJson.resume
              });

              pdf.create(html, {
                  width: '297mm',
                  height: '400mm',
                }).toFile('resume.pdf',
                function(err, res) {
                  if (err) {
                    console.log(err);
                    process.exit(1);
                  }

                  console.log(res)
                });
            });
github mosaicdao / mosaic.js / lib / populate_env_vars.js View on Github external
renderAndPopulate: function (type, vars) {
    var renderData = '';
    try {
      if (type == 'address') {
        renderData = mustache.to_html(addressTemplate, vars);
      }
      else if (type == 'contract') {
        renderData = mustache.to_html(contractTemplate, vars);
      }
      else if (type == "valueRegistrar") {
        renderData = mustache.to_html(valueRegistrarContractAddress, vars);
      }
      else if (type == "valueOpenst") {
        renderData = mustache.to_html(openstValueContractAddress, vars);
      }
      else if (type == "valueCore") {
        renderData = mustache.to_html(valueCoreContractAddress, vars);
      }
      else if (type == "deployScript2AddressesTemplate") {
        renderData = mustache.to_html(deployScript2AddressesTemplate, vars);
      }
      else {
        console.error(" Invalid Template Type To render");
        process.exit(1);
github mosaicdao / mosaic.js / lib / populate_env_vars.js View on Github external
renderData = mustache.to_html(addressTemplate, vars);
      }
      else if (type == 'contract') {
        renderData = mustache.to_html(contractTemplate, vars);
      }
      else if (type == "valueRegistrar") {
        renderData = mustache.to_html(valueRegistrarContractAddress, vars);
      }
      else if (type == "valueOpenst") {
        renderData = mustache.to_html(openstValueContractAddress, vars);
      }
      else if (type == "valueCore") {
        renderData = mustache.to_html(valueCoreContractAddress, vars);
      }
      else if (type == "deployScript2AddressesTemplate") {
        renderData = mustache.to_html(deployScript2AddressesTemplate, vars);
      }
      else {
        console.error(" Invalid Template Type To render");
        process.exit(1);
      }
      var existingSourceFileData = fs.readFileSync(Path.join(__dirname, '/' + openStEnvVarsSourceFile));
      var dataToWrite = existingSourceFileData.toString() + "\n\n" + renderData;
      //console.log("ENV Constants to Write");
      //console.log(dataToWrite);
      fs.writeFileSync(Path.join(__dirname, '/' + openStEnvVarsSourceFile), dataToWrite);
    } catch(e) {
      console.error("Error Reading and Populating Source File");
      console.error(e);
      process.exit(1);
    }
github thx / magix / docs / app / views / hellomagix.js View on Github external
render: function(){
            var node = document.getElementById(this.vcid);
            node.innerHTML = Mustache.to_html(this.template, this.queryModel.toJSON());
			Highlight.init();
            this.rendered = true;
        }
    });
github azer / lowkick / lib / server.js View on Github external
}

            var template = bf.toString(),
                view = { 
                  'revision': revision, 
                  'name': configdoc.name,
                  'sandbox': sandboxName,
                  'sandboxScripts': sandboxInst && sandboxInst.attachmentPaths,
                  'scripts': scripts, 
                  'results': results,
                  'results': JSON.stringify(results, null, 4),
                  'config': JSON.stringify(configdoc, null, 4),
                  'resultsFilename': report.filename(),
                  'configFilename': config.filename()
                },
                response = mustache.to_html(template, view);

            logging.info(( sandboxInst ? '[Sandbox ' + sandboxInst.name + '] ' : '' ) + 'Outputting test page for %s', req.headers['user-agent']);
            
            res.writeHead(200, {'Content-Type': 'text/html'});
            res.end(response);
          });
github breuleux / terminus / server / terminus-server.js View on Github external
return function (options) {
            return mustache.to_html(source, options)
        }
    },
github garann / node-for-frontend-devs / 04-03.js View on Github external
requirejs(["text!public/js/builder.js"], function(tmpl) {
        var js = mustache.to_html(tmpl, options);
        res.writeHead(200, {
          "Content-Type": "application/javascript",
          "Content-Length": js.length
        });
        res.end(js);
      });
    });
github tblobaum / nQuery / examples / twitter.js View on Github external
render: function () {
                $('body').html('<h3>Twitter Search</h3>');
	            var template = '<div id="ui-app"><h4>id: {{id}}</h4><input value="node.js"><button>Search</button><div id="ui-tweets"></div></div>';
	            this.el = mustache.to_html(template, this.model.attributes);
	            return this;
            },
github angular / angular.js / docs / collect.js View on Github external
callback.waitFor(function(err, template){
      if (err) return this.error(err);
      var content = mustache.to_html(template.toString(), doc);
      fs.writeFile(OUTPUT_DIR + output, content, callback);
    }));
}