handlebars_assets 0.15 → 0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
 
3
- handlebars v1.1.2
3
+ handlebars v1.3.0
4
4
 
5
5
  Copyright (C) 2011 by Yehuda Katz
6
6
 
@@ -24,6 +24,7 @@ THE SOFTWARE.
24
24
 
25
25
  @license
26
26
  */
27
+ /* exported Handlebars */
27
28
  var Handlebars = (function() {
28
29
  // handlebars/safe-string.js
29
30
  var __module3__ = (function() {
@@ -46,6 +47,7 @@ var __module3__ = (function() {
46
47
  var __module2__ = (function(__dependency1__) {
47
48
  "use strict";
48
49
  var __exports__ = {};
50
+ /*jshint -W004 */
49
51
  var SafeString = __dependency1__;
50
52
 
51
53
  var escape = {
@@ -66,7 +68,7 @@ var __module2__ = (function(__dependency1__) {
66
68
 
67
69
  function extend(obj, value) {
68
70
  for(var key in value) {
69
- if(value.hasOwnProperty(key)) {
71
+ if(Object.prototype.hasOwnProperty.call(value, key)) {
70
72
  obj[key] = value[key];
71
73
  }
72
74
  }
@@ -130,13 +132,25 @@ var __module4__ = (function() {
130
132
 
131
133
  var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
132
134
 
133
- function Exception(/* message */) {
134
- var tmp = Error.prototype.constructor.apply(this, arguments);
135
+ function Exception(message, node) {
136
+ var line;
137
+ if (node && node.firstLine) {
138
+ line = node.firstLine;
139
+
140
+ message += ' - ' + line + ':' + node.firstColumn;
141
+ }
142
+
143
+ var tmp = Error.prototype.constructor.call(this, message);
135
144
 
136
145
  // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
137
146
  for (var idx = 0; idx < errorProps.length; idx++) {
138
147
  this[errorProps[idx]] = tmp[errorProps[idx]];
139
148
  }
149
+
150
+ if (line) {
151
+ this.lineNumber = line;
152
+ this.column = node.firstColumn;
153
+ }
140
154
  }
141
155
 
142
156
  Exception.prototype = new Error();
@@ -149,11 +163,10 @@ var __module4__ = (function() {
149
163
  var __module1__ = (function(__dependency1__, __dependency2__) {
150
164
  "use strict";
151
165
  var __exports__ = {};
152
- /*globals Exception, Utils */
153
166
  var Utils = __dependency1__;
154
167
  var Exception = __dependency2__;
155
168
 
156
- var VERSION = "1.1.2";
169
+ var VERSION = "1.3.0";
157
170
  __exports__.VERSION = VERSION;var COMPILER_REVISION = 4;
158
171
  __exports__.COMPILER_REVISION = COMPILER_REVISION;
159
172
  var REVISION_CHANGES = {
@@ -205,7 +218,7 @@ var __module1__ = (function(__dependency1__, __dependency2__) {
205
218
  if(arguments.length === 2) {
206
219
  return undefined;
207
220
  } else {
208
- throw new Error("Missing helper: '" + arg + "'");
221
+ throw new Exception("Missing helper: '" + arg + "'");
209
222
  }
210
223
  });
211
224
 
@@ -244,7 +257,7 @@ var __module1__ = (function(__dependency1__, __dependency2__) {
244
257
  for(var j = context.length; i<j; i++) {
245
258
  if (data) {
246
259
  data.index = i;
247
- data.first = (i === 0)
260
+ data.first = (i === 0);
248
261
  data.last = (i === (context.length-1));
249
262
  }
250
263
  ret = ret + fn(context[i], { data: data });
@@ -252,7 +265,11 @@ var __module1__ = (function(__dependency1__, __dependency2__) {
252
265
  } else {
253
266
  for(var key in context) {
254
267
  if(context.hasOwnProperty(key)) {
255
- if(data) { data.key = key; }
268
+ if(data) {
269
+ data.key = key;
270
+ data.index = i;
271
+ data.first = (i === 0);
272
+ }
256
273
  ret = ret + fn(context[key], {data: data});
257
274
  i++;
258
275
  }
@@ -332,7 +349,6 @@ var __module1__ = (function(__dependency1__, __dependency2__) {
332
349
  var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
333
350
  "use strict";
334
351
  var __exports__ = {};
335
- /*global Utils */
336
352
  var Utils = __dependency1__;
337
353
  var Exception = __dependency2__;
338
354
  var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
@@ -346,42 +362,37 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
346
362
  if (compilerRevision < currentRevision) {
347
363
  var runtimeVersions = REVISION_CHANGES[currentRevision],
348
364
  compilerVersions = REVISION_CHANGES[compilerRevision];
349
- throw new Error("Template was precompiled with an older version of Handlebars than the current runtime. "+
365
+ throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. "+
350
366
  "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").");
351
367
  } else {
352
368
  // 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. "+
369
+ throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. "+
354
370
  "Please update your runtime to a newer version ("+compilerInfo[1]+").");
355
371
  }
356
372
  }
357
373
  }
358
374
 
359
- // TODO: Remove this line and break up compilePartial
375
+ __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
360
376
 
361
377
  function template(templateSpec, env) {
362
378
  if (!env) {
363
- throw new Error("No environment passed to template");
379
+ throw new Exception("No environment passed to template");
364
380
  }
365
381
 
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; }
382
+ // Note: Using env.VM references rather than local var references throughout this section to allow
383
+ // for external users to override these as psuedo-supported APIs.
384
+ var invokePartialWrapper = function(partial, name, context, helpers, partials, data) {
385
+ var result = env.VM.invokePartial.apply(this, arguments);
386
+ if (result != null) { return result; }
373
387
 
388
+ if (env.compile) {
374
389
  var options = { helpers: helpers, partials: partials, data: data };
375
390
  partials[name] = env.compile(partial, { data: data !== undefined }, env);
376
391
  return partials[name](context, options);
377
- };
378
- } else {
379
- invokePartialWrapper = function(partial, name /* , context, helpers, partials, data */) {
380
- var result = invokePartial.apply(this, arguments);
381
- if (result) { return result; }
392
+ } else {
382
393
  throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
383
- };
384
- }
394
+ }
395
+ };
385
396
 
386
397
  // Just add water
387
398
  var container = {
@@ -407,8 +418,8 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
407
418
  }
408
419
  return ret;
409
420
  },
410
- programWithDepth: programWithDepth,
411
- noop: noop,
421
+ programWithDepth: env.VM.programWithDepth,
422
+ noop: env.VM.noop,
412
423
  compilerInfo: null
413
424
  };
414
425
 
@@ -430,7 +441,7 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
430
441
  options.data);
431
442
 
432
443
  if (!options.partial) {
433
- checkRevision(container.compilerInfo);
444
+ env.VM.checkRevision(container.compilerInfo);
434
445
  }
435
446
 
436
447
  return result;
@@ -481,6 +492,7 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
481
492
  var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
482
493
  "use strict";
483
494
  var __exports__;
495
+ /*globals Handlebars: true */
484
496
  var base = __dependency1__;
485
497
 
486
498
  // Each of these augment the Handlebars object. No need to setup here.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handlebars_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.15'
4
+ version: '0.16'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Hill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-06 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs