How to use the templateSettings function from underscore

Find comprehensive JavaScript underscore.templateSettings code examples handpicked from public code repositorys.

1346
1347
1348
1349
1350
1351
1352
1353
1354
1355

// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
_.template = function(str, data) {
  var c  = _.templateSettings;
  var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
    'with(obj||{}){__p.push(\'' +
    str.replace(/\\/g, '\\\\')
       .replace(/'/g, "\\'")
fork icon0
star icon0
watch icon1

+ 6 other calls in file