handlebars_assets 0.14.1 → 0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,6 @@
1
- /*
1
+ /*!
2
+
3
+ handlebars v1.1.2
2
4
 
3
5
  Copyright (C) 2011 by Yehuda Katz
4
6
 
@@ -20,343 +22,497 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
23
  THE SOFTWARE.
22
24
 
25
+ @license
23
26
  */
24
-
25
- // lib/handlebars/browser-prefix.js
26
- var Handlebars = {};
27
-
28
- (function(Handlebars, undefined) {
29
- ;
30
- // lib/handlebars/base.js
31
-
32
- Handlebars.VERSION = "1.0.0";
33
- Handlebars.COMPILER_REVISION = 4;
34
-
35
- Handlebars.REVISION_CHANGES = {
36
- 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
37
- 2: '== 1.0.0-rc.3',
38
- 3: '== 1.0.0-rc.4',
39
- 4: '>= 1.0.0'
40
- };
41
-
42
- Handlebars.helpers = {};
43
- Handlebars.partials = {};
44
-
45
- var toString = Object.prototype.toString,
46
- functionType = '[object Function]',
47
- objectType = '[object Object]';
48
-
49
- Handlebars.registerHelper = function(name, fn, inverse) {
50
- if (toString.call(name) === objectType) {
51
- if (inverse || fn) { throw new Handlebars.Exception('Arg not supported with multiple helpers'); }
52
- Handlebars.Utils.extend(this.helpers, name);
53
- } else {
54
- if (inverse) { fn.not = inverse; }
55
- this.helpers[name] = fn;
27
+ var Handlebars = (function() {
28
+ // handlebars/safe-string.js
29
+ var __module3__ = (function() {
30
+ "use strict";
31
+ var __exports__;
32
+ // Build out our basic SafeString type
33
+ function SafeString(string) {
34
+ this.string = string;
56
35
  }
57
- };
58
36
 
59
- Handlebars.registerPartial = function(name, str) {
60
- if (toString.call(name) === objectType) {
61
- Handlebars.Utils.extend(this.partials, name);
62
- } else {
63
- this.partials[name] = str;
37
+ SafeString.prototype.toString = function() {
38
+ return "" + this.string;
39
+ };
40
+
41
+ __exports__ = SafeString;
42
+ return __exports__;
43
+ })();
44
+
45
+ // handlebars/utils.js
46
+ var __module2__ = (function(__dependency1__) {
47
+ "use strict";
48
+ var __exports__ = {};
49
+ var SafeString = __dependency1__;
50
+
51
+ var escape = {
52
+ "&": "&amp;",
53
+ "<": "&lt;",
54
+ ">": "&gt;",
55
+ '"': "&quot;",
56
+ "'": "&#x27;",
57
+ "`": "&#x60;"
58
+ };
59
+
60
+ var badChars = /[&<>"'`]/g;
61
+ var possible = /[&<>"'`]/;
62
+
63
+ function escapeChar(chr) {
64
+ return escape[chr] || "&amp;";
64
65
  }
65
- };
66
66
 
67
- Handlebars.registerHelper('helperMissing', function(arg) {
68
- if(arguments.length === 2) {
69
- return undefined;
70
- } else {
71
- throw new Error("Missing helper: '" + arg + "'");
67
+ function extend(obj, value) {
68
+ for(var key in value) {
69
+ if(value.hasOwnProperty(key)) {
70
+ obj[key] = value[key];
71
+ }
72
+ }
72
73
  }
73
- });
74
74
 
75
- Handlebars.registerHelper('blockHelperMissing', function(context, options) {
76
- var inverse = options.inverse || function() {}, fn = options.fn;
75
+ __exports__.extend = extend;var toString = Object.prototype.toString;
76
+ __exports__.toString = toString;
77
+ // Sourced from lodash
78
+ // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
79
+ var isFunction = function(value) {
80
+ return typeof value === 'function';
81
+ };
82
+ // fallback for older versions of Chrome and Safari
83
+ if (isFunction(/x/)) {
84
+ isFunction = function(value) {
85
+ return typeof value === 'function' && toString.call(value) === '[object Function]';
86
+ };
87
+ }
88
+ var isFunction;
89
+ __exports__.isFunction = isFunction;
90
+ var isArray = Array.isArray || function(value) {
91
+ return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
92
+ };
93
+ __exports__.isArray = isArray;
94
+
95
+ function escapeExpression(string) {
96
+ // don't escape SafeStrings, since they're already safe
97
+ if (string instanceof SafeString) {
98
+ return string.toString();
99
+ } else if (!string && string !== 0) {
100
+ return "";
101
+ }
77
102
 
78
- var type = toString.call(context);
103
+ // Force a string conversion as this will be done by the append regardless and
104
+ // the regex test will do this transparently behind the scenes, causing issues if
105
+ // an object's to string has escaped characters in it.
106
+ string = "" + string;
79
107
 
80
- if(type === functionType) { context = context.call(this); }
108
+ if(!possible.test(string)) { return string; }
109
+ return string.replace(badChars, escapeChar);
110
+ }
81
111
 
82
- if(context === true) {
83
- return fn(this);
84
- } else if(context === false || context == null) {
85
- return inverse(this);
86
- } else if(type === "[object Array]") {
87
- if(context.length > 0) {
88
- return Handlebars.helpers.each(context, options);
112
+ __exports__.escapeExpression = escapeExpression;function isEmpty(value) {
113
+ if (!value && value !== 0) {
114
+ return true;
115
+ } else if (isArray(value) && value.length === 0) {
116
+ return true;
89
117
  } else {
90
- return inverse(this);
118
+ return false;
91
119
  }
92
- } else {
93
- return fn(context);
94
120
  }
95
- });
96
121
 
97
- Handlebars.K = function() {};
122
+ __exports__.isEmpty = isEmpty;
123
+ return __exports__;
124
+ })(__module3__);
98
125
 
99
- Handlebars.createFrame = Object.create || function(object) {
100
- Handlebars.K.prototype = object;
101
- var obj = new Handlebars.K();
102
- Handlebars.K.prototype = null;
103
- return obj;
104
- };
126
+ // handlebars/exception.js
127
+ var __module4__ = (function() {
128
+ "use strict";
129
+ var __exports__;
105
130
 
106
- Handlebars.logger = {
107
- DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
131
+ var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
108
132
 
109
- methodMap: {0: 'debug', 1: 'info', 2: 'warn', 3: 'error'},
133
+ function Exception(/* message */) {
134
+ var tmp = Error.prototype.constructor.apply(this, arguments);
110
135
 
111
- // can be overridden in the host environment
112
- log: function(level, obj) {
113
- if (Handlebars.logger.level <= level) {
114
- var method = Handlebars.logger.methodMap[level];
115
- if (typeof console !== 'undefined' && console[method]) {
116
- console[method].call(console, obj);
117
- }
136
+ // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
137
+ for (var idx = 0; idx < errorProps.length; idx++) {
138
+ this[errorProps[idx]] = tmp[errorProps[idx]];
118
139
  }
119
140
  }
120
- };
121
141
 
122
- Handlebars.log = function(level, obj) { Handlebars.logger.log(level, obj); };
142
+ Exception.prototype = new Error();
143
+
144
+ __exports__ = Exception;
145
+ return __exports__;
146
+ })();
147
+
148
+ // handlebars/base.js
149
+ var __module1__ = (function(__dependency1__, __dependency2__) {
150
+ "use strict";
151
+ var __exports__ = {};
152
+ /*globals Exception, Utils */
153
+ var Utils = __dependency1__;
154
+ var Exception = __dependency2__;
155
+
156
+ var VERSION = "1.1.2";
157
+ __exports__.VERSION = VERSION;var COMPILER_REVISION = 4;
158
+ __exports__.COMPILER_REVISION = COMPILER_REVISION;
159
+ var REVISION_CHANGES = {
160
+ 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
161
+ 2: '== 1.0.0-rc.3',
162
+ 3: '== 1.0.0-rc.4',
163
+ 4: '>= 1.0.0'
164
+ };
165
+ __exports__.REVISION_CHANGES = REVISION_CHANGES;
166
+ var isArray = Utils.isArray,
167
+ isFunction = Utils.isFunction,
168
+ toString = Utils.toString,
169
+ objectType = '[object Object]';
170
+
171
+ function HandlebarsEnvironment(helpers, partials) {
172
+ this.helpers = helpers || {};
173
+ this.partials = partials || {};
174
+
175
+ registerDefaultHelpers(this);
176
+ }
123
177
 
124
- Handlebars.registerHelper('each', function(context, options) {
125
- var fn = options.fn, inverse = options.inverse;
126
- var i = 0, ret = "", data;
178
+ __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
179
+ constructor: HandlebarsEnvironment,
127
180
 
128
- var type = toString.call(context);
129
- if(type === functionType) { context = context.call(this); }
181
+ logger: logger,
182
+ log: log,
130
183
 
131
- if (options.data) {
132
- data = Handlebars.createFrame(options.data);
133
- }
184
+ registerHelper: function(name, fn, inverse) {
185
+ if (toString.call(name) === objectType) {
186
+ if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); }
187
+ Utils.extend(this.helpers, name);
188
+ } else {
189
+ if (inverse) { fn.not = inverse; }
190
+ this.helpers[name] = fn;
191
+ }
192
+ },
134
193
 
135
- if(context && typeof context === 'object') {
136
- if(context instanceof Array){
137
- for(var j = context.length; i<j; i++) {
138
- if (data) { data.index = i; }
139
- ret = ret + fn(context[i], { data: data });
194
+ registerPartial: function(name, str) {
195
+ if (toString.call(name) === objectType) {
196
+ Utils.extend(this.partials, name);
197
+ } else {
198
+ this.partials[name] = str;
140
199
  }
141
- } else {
142
- for(var key in context) {
143
- if(context.hasOwnProperty(key)) {
144
- if(data) { data.key = key; }
145
- ret = ret + fn(context[key], {data: data});
146
- i++;
200
+ }
201
+ };
202
+
203
+ function registerDefaultHelpers(instance) {
204
+ instance.registerHelper('helperMissing', function(arg) {
205
+ if(arguments.length === 2) {
206
+ return undefined;
207
+ } else {
208
+ throw new Error("Missing helper: '" + arg + "'");
209
+ }
210
+ });
211
+
212
+ instance.registerHelper('blockHelperMissing', function(context, options) {
213
+ var inverse = options.inverse || function() {}, fn = options.fn;
214
+
215
+ if (isFunction(context)) { context = context.call(this); }
216
+
217
+ if(context === true) {
218
+ return fn(this);
219
+ } else if(context === false || context == null) {
220
+ return inverse(this);
221
+ } else if (isArray(context)) {
222
+ if(context.length > 0) {
223
+ return instance.helpers.each(context, options);
224
+ } else {
225
+ return inverse(this);
147
226
  }
227
+ } else {
228
+ return fn(context);
148
229
  }
149
- }
150
- }
230
+ });
151
231
 
152
- if(i === 0){
153
- ret = inverse(this);
154
- }
232
+ instance.registerHelper('each', function(context, options) {
233
+ var fn = options.fn, inverse = options.inverse;
234
+ var i = 0, ret = "", data;
155
235
 
156
- return ret;
157
- });
236
+ if (isFunction(context)) { context = context.call(this); }
158
237
 
159
- Handlebars.registerHelper('if', function(conditional, options) {
160
- var type = toString.call(conditional);
161
- if(type === functionType) { conditional = conditional.call(this); }
238
+ if (options.data) {
239
+ data = createFrame(options.data);
240
+ }
162
241
 
163
- if(!conditional || Handlebars.Utils.isEmpty(conditional)) {
164
- return options.inverse(this);
165
- } else {
166
- return options.fn(this);
167
- }
168
- });
242
+ if(context && typeof context === 'object') {
243
+ if (isArray(context)) {
244
+ for(var j = context.length; i<j; i++) {
245
+ if (data) {
246
+ data.index = i;
247
+ data.first = (i === 0)
248
+ data.last = (i === (context.length-1));
249
+ }
250
+ ret = ret + fn(context[i], { data: data });
251
+ }
252
+ } else {
253
+ for(var key in context) {
254
+ if(context.hasOwnProperty(key)) {
255
+ if(data) { data.key = key; }
256
+ ret = ret + fn(context[key], {data: data});
257
+ i++;
258
+ }
259
+ }
260
+ }
261
+ }
262
+
263
+ if(i === 0){
264
+ ret = inverse(this);
265
+ }
169
266
 
170
- Handlebars.registerHelper('unless', function(conditional, options) {
171
- return Handlebars.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn});
172
- });
267
+ return ret;
268
+ });
173
269
 
174
- Handlebars.registerHelper('with', function(context, options) {
175
- var type = toString.call(context);
176
- if(type === functionType) { context = context.call(this); }
270
+ instance.registerHelper('if', function(conditional, options) {
271
+ if (isFunction(conditional)) { conditional = conditional.call(this); }
177
272
 
178
- if (!Handlebars.Utils.isEmpty(context)) return options.fn(context);
179
- });
273
+ // Default behavior is to render the positive path if the value is truthy and not empty.
274
+ // The `includeZero` option may be set to treat the condtional as purely not empty based on the
275
+ // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
276
+ if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
277
+ return options.inverse(this);
278
+ } else {
279
+ return options.fn(this);
280
+ }
281
+ });
180
282
 
181
- Handlebars.registerHelper('log', function(context, options) {
182
- var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
183
- Handlebars.log(level, context);
184
- });
185
- ;
186
- // lib/handlebars/utils.js
283
+ instance.registerHelper('unless', function(conditional, options) {
284
+ return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
285
+ });
187
286
 
188
- var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
287
+ instance.registerHelper('with', function(context, options) {
288
+ if (isFunction(context)) { context = context.call(this); }
189
289
 
190
- Handlebars.Exception = function(message) {
191
- var tmp = Error.prototype.constructor.apply(this, arguments);
290
+ if (!Utils.isEmpty(context)) return options.fn(context);
291
+ });
192
292
 
193
- // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
194
- for (var idx = 0; idx < errorProps.length; idx++) {
195
- this[errorProps[idx]] = tmp[errorProps[idx]];
293
+ instance.registerHelper('log', function(context, options) {
294
+ var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
295
+ instance.log(level, context);
296
+ });
196
297
  }
197
- };
198
- Handlebars.Exception.prototype = new Error();
199
-
200
- // Build out our basic SafeString type
201
- Handlebars.SafeString = function(string) {
202
- this.string = string;
203
- };
204
- Handlebars.SafeString.prototype.toString = function() {
205
- return this.string.toString();
206
- };
207
-
208
- var escape = {
209
- "&": "&amp;",
210
- "<": "&lt;",
211
- ">": "&gt;",
212
- '"': "&quot;",
213
- "'": "&#x27;",
214
- "`": "&#x60;"
215
- };
216
-
217
- var badChars = /[&<>"'`]/g;
218
- var possible = /[&<>"'`]/;
219
-
220
- var escapeChar = function(chr) {
221
- return escape[chr] || "&amp;";
222
- };
223
-
224
- Handlebars.Utils = {
225
- extend: function(obj, value) {
226
- for(var key in value) {
227
- if(value.hasOwnProperty(key)) {
228
- obj[key] = value[key];
298
+
299
+ var logger = {
300
+ methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
301
+
302
+ // State enum
303
+ DEBUG: 0,
304
+ INFO: 1,
305
+ WARN: 2,
306
+ ERROR: 3,
307
+ level: 3,
308
+
309
+ // can be overridden in the host environment
310
+ log: function(level, obj) {
311
+ if (logger.level <= level) {
312
+ var method = logger.methodMap[level];
313
+ if (typeof console !== 'undefined' && console[method]) {
314
+ console[method].call(console, obj);
315
+ }
229
316
  }
230
317
  }
231
- },
232
-
233
- escapeExpression: function(string) {
234
- // don't escape SafeStrings, since they're already safe
235
- if (string instanceof Handlebars.SafeString) {
236
- return string.toString();
237
- } else if (string == null || string === false) {
238
- return "";
318
+ };
319
+ __exports__.logger = logger;
320
+ function log(level, obj) { logger.log(level, obj); }
321
+
322
+ __exports__.log = log;var createFrame = function(object) {
323
+ var obj = {};
324
+ Utils.extend(obj, object);
325
+ return obj;
326
+ };
327
+ __exports__.createFrame = createFrame;
328
+ return __exports__;
329
+ })(__module2__, __module4__);
330
+
331
+ // handlebars/runtime.js
332
+ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
333
+ "use strict";
334
+ var __exports__ = {};
335
+ /*global Utils */
336
+ var Utils = __dependency1__;
337
+ var Exception = __dependency2__;
338
+ var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
339
+ var REVISION_CHANGES = __dependency3__.REVISION_CHANGES;
340
+
341
+ function checkRevision(compilerInfo) {
342
+ var compilerRevision = compilerInfo && compilerInfo[0] || 1,
343
+ currentRevision = COMPILER_REVISION;
344
+
345
+ if (compilerRevision !== currentRevision) {
346
+ if (compilerRevision < currentRevision) {
347
+ var runtimeVersions = REVISION_CHANGES[currentRevision],
348
+ compilerVersions = REVISION_CHANGES[compilerRevision];
349
+ throw new Error("Template was precompiled with an older version of Handlebars than the current runtime. "+
350
+ "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").");
351
+ } else {
352
+ // Use the embedded version info since the runtime doesn't know about this revision yet
353
+ throw new Error("Template was precompiled with a newer version of Handlebars than the current runtime. "+
354
+ "Please update your runtime to a newer version ("+compilerInfo[1]+").");
355
+ }
239
356
  }
357
+ }
240
358
 
241
- // Force a string conversion as this will be done by the append regardless and
242
- // the regex test will do this transparently behind the scenes, causing issues if
243
- // an object's to string has escaped characters in it.
244
- string = string.toString();
359
+ // TODO: Remove this line and break up compilePartial
245
360
 
246
- if(!possible.test(string)) { return string; }
247
- return string.replace(badChars, escapeChar);
248
- },
361
+ function template(templateSpec, env) {
362
+ if (!env) {
363
+ throw new Error("No environment passed to template");
364
+ }
249
365
 
250
- isEmpty: function(value) {
251
- if (!value && value !== 0) {
252
- return true;
253
- } else if(toString.call(value) === "[object Array]" && value.length === 0) {
254
- return true;
366
+ var invokePartialWrapper;
367
+ if (env.compile) {
368
+ invokePartialWrapper = function(partial, name, context, helpers, partials, data) {
369
+ // TODO : Check this for all inputs and the options handling (partial flag, etc). This feels
370
+ // like there should be a common exec path
371
+ var result = invokePartial.apply(this, arguments);
372
+ if (result) { return result; }
373
+
374
+ var options = { helpers: helpers, partials: partials, data: data };
375
+ partials[name] = env.compile(partial, { data: data !== undefined }, env);
376
+ return partials[name](context, options);
377
+ };
255
378
  } else {
256
- return false;
379
+ invokePartialWrapper = function(partial, name /* , context, helpers, partials, data */) {
380
+ var result = invokePartial.apply(this, arguments);
381
+ if (result) { return result; }
382
+ throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
383
+ };
257
384
  }
258
- }
259
- };
260
- ;
261
- // lib/handlebars/runtime.js
262
385
 
263
- Handlebars.VM = {
264
- template: function(templateSpec) {
265
386
  // Just add water
266
387
  var container = {
267
- escapeExpression: Handlebars.Utils.escapeExpression,
268
- invokePartial: Handlebars.VM.invokePartial,
388
+ escapeExpression: Utils.escapeExpression,
389
+ invokePartial: invokePartialWrapper,
269
390
  programs: [],
270
391
  program: function(i, fn, data) {
271
392
  var programWrapper = this.programs[i];
272
393
  if(data) {
273
- programWrapper = Handlebars.VM.program(i, fn, data);
394
+ programWrapper = program(i, fn, data);
274
395
  } else if (!programWrapper) {
275
- programWrapper = this.programs[i] = Handlebars.VM.program(i, fn);
396
+ programWrapper = this.programs[i] = program(i, fn);
276
397
  }
277
398
  return programWrapper;
278
399
  },
279
400
  merge: function(param, common) {
280
401
  var ret = param || common;
281
402
 
282
- if (param && common) {
403
+ if (param && common && (param !== common)) {
283
404
  ret = {};
284
- Handlebars.Utils.extend(ret, common);
285
- Handlebars.Utils.extend(ret, param);
405
+ Utils.extend(ret, common);
406
+ Utils.extend(ret, param);
286
407
  }
287
408
  return ret;
288
409
  },
289
- programWithDepth: Handlebars.VM.programWithDepth,
290
- noop: Handlebars.VM.noop,
410
+ programWithDepth: programWithDepth,
411
+ noop: noop,
291
412
  compilerInfo: null
292
413
  };
293
414
 
294
415
  return function(context, options) {
295
416
  options = options || {};
296
- var result = templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);
297
-
298
- var compilerInfo = container.compilerInfo || [],
299
- compilerRevision = compilerInfo[0] || 1,
300
- currentRevision = Handlebars.COMPILER_REVISION;
301
-
302
- if (compilerRevision !== currentRevision) {
303
- if (compilerRevision < currentRevision) {
304
- var runtimeVersions = Handlebars.REVISION_CHANGES[currentRevision],
305
- compilerVersions = Handlebars.REVISION_CHANGES[compilerRevision];
306
- throw "Template was precompiled with an older version of Handlebars than the current runtime. "+
307
- "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").";
308
- } else {
309
- // Use the embedded version info since the runtime doesn't know about this revision yet
310
- throw "Template was precompiled with a newer version of Handlebars than the current runtime. "+
311
- "Please update your runtime to a newer version ("+compilerInfo[1]+").";
312
- }
417
+ var namespace = options.partial ? options : env,
418
+ helpers,
419
+ partials;
420
+
421
+ if (!options.partial) {
422
+ helpers = options.helpers;
423
+ partials = options.partials;
424
+ }
425
+ var result = templateSpec.call(
426
+ container,
427
+ namespace, context,
428
+ helpers,
429
+ partials,
430
+ options.data);
431
+
432
+ if (!options.partial) {
433
+ checkRevision(container.compilerInfo);
313
434
  }
314
435
 
315
436
  return result;
316
437
  };
317
- },
438
+ }
318
439
 
319
- programWithDepth: function(i, fn, data /*, $depth */) {
440
+ __exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) {
320
441
  var args = Array.prototype.slice.call(arguments, 3);
321
442
 
322
- var program = function(context, options) {
443
+ var prog = function(context, options) {
323
444
  options = options || {};
324
445
 
325
446
  return fn.apply(this, [context, options.data || data].concat(args));
326
447
  };
327
- program.program = i;
328
- program.depth = args.length;
329
- return program;
330
- },
331
- program: function(i, fn, data) {
332
- var program = function(context, options) {
448
+ prog.program = i;
449
+ prog.depth = args.length;
450
+ return prog;
451
+ }
452
+
453
+ __exports__.programWithDepth = programWithDepth;function program(i, fn, data) {
454
+ var prog = function(context, options) {
333
455
  options = options || {};
334
456
 
335
457
  return fn(context, options.data || data);
336
458
  };
337
- program.program = i;
338
- program.depth = 0;
339
- return program;
340
- },
341
- noop: function() { return ""; },
342
- invokePartial: function(partial, name, context, helpers, partials, data) {
343
- var options = { helpers: helpers, partials: partials, data: data };
459
+ prog.program = i;
460
+ prog.depth = 0;
461
+ return prog;
462
+ }
463
+
464
+ __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) {
465
+ var options = { partial: true, helpers: helpers, partials: partials, data: data };
344
466
 
345
467
  if(partial === undefined) {
346
- throw new Handlebars.Exception("The partial " + name + " could not be found");
468
+ throw new Exception("The partial " + name + " could not be found");
347
469
  } else if(partial instanceof Function) {
348
470
  return partial(context, options);
349
- } else if (!Handlebars.compile) {
350
- throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
351
- } else {
352
- partials[name] = Handlebars.compile(partial, {data: data !== undefined});
353
- return partials[name](context, options);
354
471
  }
355
472
  }
356
- };
357
473
 
358
- Handlebars.template = Handlebars.VM.template;
359
- ;
360
- // lib/handlebars/browser-suffix.js
361
- })(Handlebars);
362
- ;
474
+ __exports__.invokePartial = invokePartial;function noop() { return ""; }
475
+
476
+ __exports__.noop = noop;
477
+ return __exports__;
478
+ })(__module2__, __module4__, __module1__);
479
+
480
+ // handlebars.runtime.js
481
+ var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
482
+ "use strict";
483
+ var __exports__;
484
+ var base = __dependency1__;
485
+
486
+ // Each of these augment the Handlebars object. No need to setup here.
487
+ // (This is done to easily share code between commonjs and browse envs)
488
+ var SafeString = __dependency2__;
489
+ var Exception = __dependency3__;
490
+ var Utils = __dependency4__;
491
+ var runtime = __dependency5__;
492
+
493
+ // For compatibility and usage outside of module systems, make the Handlebars object a namespace
494
+ var create = function() {
495
+ var hb = new base.HandlebarsEnvironment();
496
+
497
+ Utils.extend(hb, base);
498
+ hb.SafeString = SafeString;
499
+ hb.Exception = Exception;
500
+ hb.Utils = Utils;
501
+
502
+ hb.VM = runtime;
503
+ hb.template = function(spec) {
504
+ return runtime.template(spec, hb);
505
+ };
506
+
507
+ return hb;
508
+ };
509
+
510
+ var Handlebars = create();
511
+ Handlebars.create = create;
512
+
513
+ __exports__ = Handlebars;
514
+ return __exports__;
515
+ })(__module1__, __module3__, __module4__, __module2__, __module5__);
516
+
517
+ return __module0__;
518
+ })();