How to use the handlebars.template function in handlebars

To help you get started, we’ve selected a few handlebars 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 kriasoft / nodejs-api-starter / src / email.js View on Github external
function loadTemplate(filename) {
  const m = new module.constructor();
  // eslint-disable-next-line no-underscore-dangle
  m._compile(fs.readFileSync(filename, 'utf8'), filename);
  return handlebars.template(m.exports);
}
github chrisabrams / The-Tramp / test / app / templates / home.js View on Github external
Handlebars = require('handlebars')

module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;


  buffer += "<ul id="\&quot;&quot;;"></ul>\n";
  return buffer;
  })
;
github adamgruber / mochawesome / lib / templates.js View on Github external
return "      <ul class="\&quot;list-unstyled">\n        "
    + ((stack1 = this.invokePartial(partials._navMenu,depth0,{"name":"_navMenu","data":data,"helpers":helpers,"partials":partials})) != null ? stack1 : "")
    + "      </ul>\n";
},"compiler":[6,"&gt;= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
    var stack1, helper, options, alias1=helpers.helperMissing, alias2="function", alias3=helpers.blockHelperMissing, buffer = "";

  stack1 = ((helper = (helper = helpers.rootEmpty || (depth0 != null ? depth0.rootEmpty : depth0)) != null ? helper : alias1),(options={"name":"rootEmpty","hash":{},"fn":this.program(1, data, 0),"inverse":this.noop,"data":data}),(typeof helper === alias2 ? helper.call(depth0,options) : helper));
  if (!helpers.rootEmpty) { stack1 = alias3.call(depth0,stack1,options)}
  if (stack1 != null) { buffer += stack1; }
  stack1 = ((helper = (helper = helpers.rootEmpty || (depth0 != null ? depth0.rootEmpty : depth0)) != null ? helper : alias1),(options={"name":"rootEmpty","hash":{},"fn":this.noop,"inverse":this.program(4, data, 0),"data":data}),(typeof helper === alias2 ? helper.call(depth0,options) : helper));
  if (!helpers.rootEmpty) { stack1 = alias3.call(depth0,stack1,options)}
  if (stack1 != null) { buffer += stack1; }
  return buffer;
},"usePartial":true,"useData":true}));
exports["mochawesome"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
    var stack1;

  return "<style>"
    + ((stack1 = (helpers.inlineAsset || (depth0 && depth0.inlineAsset) || helpers.helperMissing).call(depth0,"styles",{"name":"inlineAsset","hash":{},"data":data})) != null ? stack1 : "")
    + "</style>";
},"3":function(depth0,helpers,partials,data) {
    return "";
},"5":function(depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = this.invokePartial(partials._quickSummary,depth0,{"name":"_quickSummary","data":data,"indent":"              ","helpers":helpers,"partials":partials})) != null ? stack1 : "");
},"7":function(depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = this.invokePartial(partials._summary,depth0,{"name":"_summary","data":data,"indent":"          ","helpers":helpers,"partials":partials})) != null ? stack1 : "");
},"9":function(depth0,helpers,partials,data) {
github adamgruber / mochawesome / lib / templates.js View on Github external
});

Handlebars.registerHelper('inlineAsset', function(context) {
  'use strict';
  var distDir = path.join(__dirname, '..', 'dist');
  switch (context) {
    case 'styles':
      return fs.readFileSync(path.join(distDir, 'css', 'mochawesome-64.css'));

    case 'scripts':
      var vendorScripts = fs.readFileSync(path.join(distDir, 'js', 'vendor.js'));
      var mochawesomeScript = fs.readFileSync(path.join(distDir, 'js', 'mochawesome.js'));
      return vendorScripts + '\n' + mochawesomeScript;
  }
});
Handlebars.registerPartial("_quickSummary", Handlebars.template({"compiler":[6,"&gt;= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
    var helper, alias1=helpers.helperMissing, alias2=this.escapeExpression, alias3="function";

  return "<ul class="\&quot;list-unstyled">\n  <li title="\&quot;Duration\&quot;" class="\&quot;qs-item">"
    + alias2((helpers.formatSummaryDuration || (depth0 &amp;&amp; depth0.formatSummaryDuration) || alias1).call(depth0,(depth0 != null ? depth0.duration : depth0),{"name":"formatSummaryDuration","hash":{},"data":data}))
    + "<span>"
    + alias2((helpers.getSummaryDurationUnits || (depth0 &amp;&amp; depth0.getSummaryDurationUnits) || alias1).call(depth0,(depth0 != null ? depth0.duration : depth0),{"name":"getSummaryDurationUnits","hash":{},"data":data}))
    + "</span></li>\n  <li title="\&quot;Suites\&quot;" class="\&quot;qs-item">"
    + alias2(((helper = (helper = helpers.suites || (depth0 != null ? depth0.suites : depth0)) != null ? helper : alias1),(typeof helper === alias3 ? helper.call(depth0,{"name":"suites","hash":{},"data":data}) : helper)))
    + "</li>\n  <li title="\&quot;Tests\&quot;" class="\&quot;qs-item">"
    + alias2(((helper = (helper = helpers.testsRegistered || (depth0 != null ? depth0.testsRegistered : depth0)) != null ? helper : alias1),(typeof helper === alias3 ? helper.call(depth0,{"name":"testsRegistered","hash":{},"data":data}) : helper)))
    + "</li>\n  <li data-filter="\&quot;passed\&quot;" title="\&quot;Passed\&quot;" class="\&quot;qs-item">"
    + alias2(((helper = (helper = helpers.passes || (depth0 != null ? depth0.passes : depth0)) != null ? helper : alias1),(typeof helper === alias3 ? helper.call(depth0,{"name":"passes","hash":{},"data":data}) : helper)))
    + "</li>\n  <li data-filter="\&quot;failed\&quot;" title="\&quot;Failed\&quot;" class="\&quot;qs-item">"
    + alias2(((helper = (helper = helpers.failures || (depth0 != null ? depth0.failures : depth0)) != null ? helper : alias1),(typeof helper === alias3 ? helper.call(depth0,{"name":"failures","hash":{},"data":data}) : helper)))
    + "</li>\n  <li data-filter="\&quot;pending\&quot;" title="\&quot;Pending\&quot;" class="\&quot;qs-item">"
    + alias2(((helper = (helper = helpers.pending || (depth0 != null ? depth0.pending : depth0)) != null ? helper : alias1),(typeof helper === alias3 ? helper.call(depth0,{"name":"pending","hash":{},"data":data}) : helper)))</li></ul>
github BelAn97 / mochawesome-screenshots / lib / templates.js View on Github external
return "      <ul class="\&quot;list-unstyled">\n        "
        + ((stack1 = this.invokePartial(partials._navMenu,depth0,{"name":"_navMenu","data":data,"helpers":helpers,"partials":partials})) != null ? stack1 : "")
        + "      </ul>\n";
},"compiler":[6,"&gt;= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
    var stack1, helper, options, alias1=helpers.helperMissing, alias2="function", alias3=helpers.blockHelperMissing, buffer = "";

    stack1 = ((helper = (helper = helpers.rootEmpty || (depth0 != null ? depth0.rootEmpty : depth0)) != null ? helper : alias1),(options={"name":"rootEmpty","hash":{},"fn":this.program(1, data, 0),"inverse":this.noop,"data":data}),(typeof helper === alias2 ? helper.call(depth0,options) : helper));
    if (!helpers.rootEmpty) { stack1 = alias3.call(depth0,stack1,options)}
    if (stack1 != null) { buffer += stack1; }
    stack1 = ((helper = (helper = helpers.rootEmpty || (depth0 != null ? depth0.rootEmpty : depth0)) != null ? helper : alias1),(options={"name":"rootEmpty","hash":{},"fn":this.noop,"inverse":this.program(4, data, 0),"data":data}),(typeof helper === alias2 ? helper.call(depth0,options) : helper));
    if (!helpers.rootEmpty) { stack1 = alias3.call(depth0,stack1,options)}
    if (stack1 != null) { buffer += stack1; }
    return buffer;
},"usePartial":true,"useData":true}));
exports["mochawesome"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
    var stack1;

    return "<style>"
        + ((stack1 = (helpers.inlineAsset || (depth0 && depth0.inlineAsset) || helpers.helperMissing).call(depth0,"styles",{"name":"inlineAsset","hash":{},"data":data})) != null ? stack1 : "")
        + "</style>";
},"3":function(depth0,helpers,partials,data) {
    return "";
},"5":function(depth0,helpers,partials,data) {
    var stack1;

    return ((stack1 = this.invokePartial(partials._quickSummary,depth0,{"name":"_quickSummary","data":data,"indent":"              ","helpers":helpers,"partials":partials})) != null ? stack1 : "");
},"7":function(depth0,helpers,partials,data) {
    var stack1;

    return ((stack1 = this.invokePartial(partials._summary,depth0,{"name":"_summary","data":data,"indent":"          ","helpers":helpers,"partials":partials})) != null ? stack1 : "");
},"9":function(depth0,helpers,partials,data) {
github microsoft / PowerBI-visuals-FacetKey / lib / @uncharted.software / stories-facets / src / templates / group-more.js View on Github external
var Handlebars = require("handlebars");module.exports = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return " group-other-target\" style=\"cursor: pointer;";
},"3":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = (helpers.ifCond || (depth0 &amp;&amp; depth0.ifCond) || helpers.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.more : depth0),"instanceof","number",{"name":"ifCond","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(7, data, 0),"data":data})) != null ? stack1 : "");
},"4":function(container,depth0,helpers,partials,data) {
    var stack1;

  return ((stack1 = (helpers.ifCond || (depth0 &amp;&amp; depth0.ifCond) || helpers.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.more : depth0),"&gt;",0,{"name":"ifCond","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "");
},"5":function(container,depth0,helpers,partials,data) {
    var helper;

  return "                <div class="\&quot;group-more-marker\&quot;">\n                    <i>●</i>\n                </div>\n                <div class="\&quot;group-other-block\&quot;">\n                    <div class="\&quot;group-other-bar\&quot;"></div>\n                    <div class="\&quot;group-other-label-container\&quot;">\n                        <span class="\&quot;group-other-label-count\&quot;">"
    + container.escapeExpression(((helper = (helper = helpers.more || (depth0 != null ? depth0.more : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"more","hash":{},"data":data}) : helper)))
    + "+</span>\n                        <span class="\&quot;group-other-label-other\&quot;">other</span>\n                        <span class="\&quot;group-other-label-show-more">show more</span>\n                    </div>\n                </div>\n";
},"7":function(container,depth0,helpers,partials,data) {
github microsoft / PowerBI-visuals-FacetKey / lib / @uncharted.software / stories-facets / src / templates / facetPlaceholder.js View on Github external
var Handlebars = require("handlebars");module.exports = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "    facets-facet-placeholder-hidden\n";
},"compiler":[7,"&gt;= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function";

  return "<div class="\&quot;facets-facet-base" id="\&quot;&quot;">\n    <div class="\&quot;facet-block\&quot;">\n        <div class="\&quot;facet-html\&quot;">\n            "
    + ((stack1 = ((helper = (helper = helpers.html || (depth0 != null ? depth0.html : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"html","hash":{},"data":data}) : helper))) != null ? stack1 : "")
    + "\n        </div>\n    </div>\n</div>\n";
},"useData":true});
github microsoft / PowerBI-visuals-FacetKey / lib / @uncharted.software / stories-facets / src / templates / badge.js View on Github external
var Handlebars = require("handlebars");module.exports = Handlebars.template({"compiler":[7,"&gt;= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, helper;

  return "<div class="\&quot;facets-badge\&quot;">\n  <span class="\&quot;badge-label\&quot;">"
    + ((stack1 = ((helper = (helper = helpers.label || (depth0 != null ? depth0.label : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"label","hash":{},"data":data}) : helper))) != null ? stack1 : "")
    + "</span>\n  <span class="\&quot;badge-close\&quot;">\n    <i class="\&quot;fa"></i>\n  </span>\n</div>\n";
},"useData":true});
github microsoft / PowerBI-visuals-FacetKey / lib / uncharted-facets / public / javascripts / templates / facetVertical.js View on Github external
var Handlebars = require('handlebars');module.exports = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    return "	facets-facet-vertical-hidden\n";
},"3":function(container,depth0,helpers,partials,data) {
    var stack1, helper;

  return "                    "
    + ((stack1 = ((helper = (helper = helpers.countLabel || (depth0 != null ? depth0.countLabel : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"countLabel","hash":{},"data":data}) : helper))) != null ? stack1 : "")
    + "\n";
},"5":function(container,depth0,helpers,partials,data) {
    var helper;

  return "					"
    + container.escapeExpression(((helper = (helper = helpers.count || (depth0 != null ? depth0.count : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"count","hash":{},"data":data}) : helper)))
    + "\n";
},"7":function(container,depth0,helpers,partials,data) {
    var stack1, helper;