How to use the jsrender.templates function in jsrender

To help you get started, we’ve selected a few jsrender 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 GEOLYTIX / xyz / routes / login.js View on Github external
// Fail messaged to be displayed for msg query parameter in redirect.
    const msgs = {
      fail: 'Login has failed.<br>'
      + 'This may be due to insufficient priviliges or the account being locked.<br>'
      + 'Please check your inbox for an email with additional details.',
      validation: 'Please check your inbox for an email with additional details.',
      reset: 'The password has been reset for this account.',
      approval: 'This account has been verified but requires administrator approval.',
      badconfig: 'There seems to be a problem with the ACL configuration.'
    };
  
    // Send login view to client.
    res
      .type('text/html')
      .send(jsr
        .templates('./public/views/login.html')
        .render({
          dir: env.path,
          action: req.req.url,
          msg: req.query.msg ? msgs[req.query.msg] : null,
          captcha: env.captcha &amp;&amp; env.captcha[0],
        }));  

  }
github BorisMoore / jsviews.com / test / unit-tests / tests-node.js View on Github external
QUnit.test("jsrender.templates", function(assert) {
	var tmpl = jsrender.templates('./test/templates/name-template.html');
	var html = tmpl({name: "Jo"});
	assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.templates("./file.path.html") compiles template');

	tmpl = jsrender.templates({markup: 'Some {{:~upper("Markup")}} Name: {{:~upper(name)}} {{lower:name}}', helpers: {upper:upper}, converters: {lower:lower}});
	html = tmpl({name: "Jo"});
	assert.equal(html, "Some MARKUP Name: JO jo", 'jsrender.templates({markup: ..., helpers: ..., ...}) compiles template with options');
});
github BorisMoore / jsviews.com / test / unit-tests / tests-node.js View on Github external
QUnit.test("jsrender.templates", function(assert) {
	var tmpl = jsrender.templates('./test/templates/name-template.html');
	var html = tmpl({name: "Jo"});
	assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.templates("./file.path.html") compiles template');

	tmpl = jsrender.templates({markup: 'Some {{:~upper("Markup")}} Name: {{:~upper(name)}} {{lower:name}}', helpers: {upper:upper}, converters: {lower:lower}});
	html = tmpl({name: "Jo"});
	assert.equal(html, "Some MARKUP Name: JO jo", 'jsrender.templates({markup: ..., helpers: ..., ...}) compiles template with options');
});
github OData / model-first / resources / js / editor.js View on Github external
for(var index in errors){
        var error={errorType:null,errDes:'',ln:0};

        error.errDes=!!( errors[index].description)? 
          errors[index].description: errors[index].message;

        if(errors[index].yamlError){
          error.errorType = 'Yaml Error';
          error.ln=errors[index].lineNumber;
        } else {
          error.errorType = 'Simple Yaml Error';
          var range = positionRangeForPath(input, errors[index].path);
          error.ln = range.start.line + 1;
        }
        console.log(error.errDes);
        var t = jsrender.templates('#errorTemp').render(error);
        console.log(t);
        $(t).appendTo('#errors');
      }
    }
github GEOLYTIX / xyz / routes / register.js View on Github external
handler: (req, res) => {
      res
        .type('text/html')
        .send(jsr
          .templates('./public/views/register.html')
          .render({
            dir: env.path,
            captcha: env.captcha && env.captcha[0],
          }));
    }
  });

jsrender

Best-of-breed templating in browser or on Node.js (with Express 4, Hapi and Browserify integration)

MIT
Latest version published 4 months ago

Package Health Score

68 / 100
Full package analysis