handlebars-source 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of handlebars-source might be problematic. Click here for more details.

Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/handlebars.js +166 -150
  3. data/handlebars.runtime.js +25 -25
  4. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a78fffe0a98d67f6868319e2a20fa5f51358e96
4
- data.tar.gz: b0d53e5048cedbc652af75746331ed9cfac9425b
3
+ metadata.gz: 2103e671258424ac95c7d6bae42b5746b1571813
4
+ data.tar.gz: f23322d6a956dd6e1b09d1576cd1743754675b39
5
5
  SHA512:
6
- metadata.gz: 7eee27d2f808337cfdb9faab51f6dc77e255fd4a33ae6d4b4d3075934f5e102cc1a1f6c61c15a648494682197acca9491350e2b37225dd2e7e2f217d703e23f9
7
- data.tar.gz: a9f8c5c0696a566fd3abb2a1bed5186d5db8d2b78afa6f7c0a219530498493b4834e6d2e46c46643225e3f060d87ec9986e7ea322b984ae84c5c52d76451d051
6
+ metadata.gz: 5d09354a752423136ac9a8c717e229d8c1f0d16be4db56e7074ba710e489b4387715d78eb5ce227fdc3b265f31667ef2285ffc4e67b87eacffa777a47d53ac17
7
+ data.tar.gz: f31745697b2fc4123fac76cb7499415dedb85472d86f65fedf1d3bcb1bbd447791a5f8d6c03bf9e3362eec0d8032ae4bc7c0650611148a66197d3ee30c97b247
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
 
3
- handlebars v1.1.2
3
+ handlebars v1.2.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 __module4__ = (function() {
@@ -46,6 +47,7 @@ var __module4__ = (function() {
46
47
  var __module3__ = (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 __module3__ = (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
  }
@@ -149,11 +151,10 @@ var __module5__ = (function() {
149
151
  var __module2__ = (function(__dependency1__, __dependency2__) {
150
152
  "use strict";
151
153
  var __exports__ = {};
152
- /*globals Exception, Utils */
153
154
  var Utils = __dependency1__;
154
155
  var Exception = __dependency2__;
155
156
 
156
- var VERSION = "1.1.2";
157
+ var VERSION = "1.2.0";
157
158
  __exports__.VERSION = VERSION;var COMPILER_REVISION = 4;
158
159
  __exports__.COMPILER_REVISION = COMPILER_REVISION;
159
160
  var REVISION_CHANGES = {
@@ -244,7 +245,7 @@ var __module2__ = (function(__dependency1__, __dependency2__) {
244
245
  for(var j = context.length; i<j; i++) {
245
246
  if (data) {
246
247
  data.index = i;
247
- data.first = (i === 0)
248
+ data.first = (i === 0);
248
249
  data.last = (i === (context.length-1));
249
250
  }
250
251
  ret = ret + fn(context[i], { data: data });
@@ -252,7 +253,11 @@ var __module2__ = (function(__dependency1__, __dependency2__) {
252
253
  } else {
253
254
  for(var key in context) {
254
255
  if(context.hasOwnProperty(key)) {
255
- if(data) { data.key = key; }
256
+ if(data) {
257
+ data.key = key;
258
+ data.index = i;
259
+ data.first = (i === 0);
260
+ }
256
261
  ret = ret + fn(context[key], {data: data});
257
262
  i++;
258
263
  }
@@ -332,7 +337,6 @@ var __module2__ = (function(__dependency1__, __dependency2__) {
332
337
  var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
333
338
  "use strict";
334
339
  var __exports__ = {};
335
- /*global Utils */
336
340
  var Utils = __dependency1__;
337
341
  var Exception = __dependency2__;
338
342
  var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
@@ -356,32 +360,27 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
356
360
  }
357
361
  }
358
362
 
359
- // TODO: Remove this line and break up compilePartial
363
+ __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
360
364
 
361
365
  function template(templateSpec, env) {
362
366
  if (!env) {
363
367
  throw new Error("No environment passed to template");
364
368
  }
365
369
 
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; }
370
+ // Note: Using env.VM references rather than local var references throughout this section to allow
371
+ // for external users to override these as psuedo-supported APIs.
372
+ var invokePartialWrapper = function(partial, name, context, helpers, partials, data) {
373
+ var result = env.VM.invokePartial.apply(this, arguments);
374
+ if (result != null) { return result; }
373
375
 
376
+ if (env.compile) {
374
377
  var options = { helpers: helpers, partials: partials, data: data };
375
378
  partials[name] = env.compile(partial, { data: data !== undefined }, env);
376
379
  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; }
380
+ } else {
382
381
  throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
383
- };
384
- }
382
+ }
383
+ };
385
384
 
386
385
  // Just add water
387
386
  var container = {
@@ -407,8 +406,8 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
407
406
  }
408
407
  return ret;
409
408
  },
410
- programWithDepth: programWithDepth,
411
- noop: noop,
409
+ programWithDepth: env.VM.programWithDepth,
410
+ noop: env.VM.noop,
412
411
  compilerInfo: null
413
412
  };
414
413
 
@@ -430,7 +429,7 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
430
429
  options.data);
431
430
 
432
431
  if (!options.partial) {
433
- checkRevision(container.compilerInfo);
432
+ env.VM.checkRevision(container.compilerInfo);
434
433
  }
435
434
 
436
435
  return result;
@@ -481,6 +480,7 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
481
480
  var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
482
481
  "use strict";
483
482
  var __exports__;
483
+ /*globals Handlebars: true */
484
484
  var base = __dependency1__;
485
485
 
486
486
  // Each of these augment the Handlebars object. No need to setup here.
@@ -517,154 +517,164 @@ var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, _
517
517
  // handlebars/compiler/ast.js
518
518
  var __module7__ = (function(__dependency1__) {
519
519
  "use strict";
520
- var __exports__ = {};
520
+ var __exports__;
521
521
  var Exception = __dependency1__;
522
522
 
523
- function ProgramNode(statements, inverseStrip, inverse) {
524
- this.type = "program";
525
- this.statements = statements;
526
- this.strip = {};
523
+ var AST = {
524
+ ProgramNode: function(statements, inverseStrip, inverse) {
525
+ this.type = "program";
526
+ this.statements = statements;
527
+ this.strip = {};
527
528
 
528
- if(inverse) {
529
- this.inverse = new ProgramNode(inverse, inverseStrip);
530
- this.strip.right = inverseStrip.left;
531
- } else if (inverseStrip) {
532
- this.strip.left = inverseStrip.right;
533
- }
534
- }
529
+ if(inverse) {
530
+ this.inverse = new AST.ProgramNode(inverse, inverseStrip);
531
+ this.strip.right = inverseStrip.left;
532
+ } else if (inverseStrip) {
533
+ this.strip.left = inverseStrip.right;
534
+ }
535
+ },
535
536
 
536
- __exports__.ProgramNode = ProgramNode;function MustacheNode(rawParams, hash, open, strip) {
537
- this.type = "mustache";
538
- this.hash = hash;
539
- this.strip = strip;
537
+ MustacheNode: function(rawParams, hash, open, strip) {
538
+ this.type = "mustache";
539
+ this.hash = hash;
540
+ this.strip = strip;
540
541
 
541
- var escapeFlag = open[3] || open[2];
542
- this.escaped = escapeFlag !== '{' && escapeFlag !== '&';
542
+ // Open may be a string parsed from the parser or a passed boolean flag
543
+ if (open != null && open.charAt) {
544
+ // Must use charAt to support IE pre-10
545
+ var escapeFlag = open.charAt(3) || open.charAt(2);
546
+ this.escaped = escapeFlag !== '{' && escapeFlag !== '&';
547
+ } else {
548
+ this.escaped = !!open;
549
+ }
543
550
 
544
- var id = this.id = rawParams[0];
545
- var params = this.params = rawParams.slice(1);
551
+ var id = this.id = rawParams[0];
552
+ var params = this.params = rawParams.slice(1);
546
553
 
547
- // a mustache is an eligible helper if:
548
- // * its id is simple (a single part, not `this` or `..`)
549
- var eligibleHelper = this.eligibleHelper = id.isSimple;
554
+ // a mustache is an eligible helper if:
555
+ // * its id is simple (a single part, not `this` or `..`)
556
+ var eligibleHelper = this.eligibleHelper = id.isSimple;
550
557
 
551
- // a mustache is definitely a helper if:
552
- // * it is an eligible helper, and
553
- // * it has at least one parameter or hash segment
554
- this.isHelper = eligibleHelper && (params.length || hash);
558
+ // a mustache is definitely a helper if:
559
+ // * it is an eligible helper, and
560
+ // * it has at least one parameter or hash segment
561
+ this.isHelper = eligibleHelper && (params.length || hash);
555
562
 
556
- // if a mustache is an eligible helper but not a definite
557
- // helper, it is ambiguous, and will be resolved in a later
558
- // pass or at runtime.
559
- }
563
+ // if a mustache is an eligible helper but not a definite
564
+ // helper, it is ambiguous, and will be resolved in a later
565
+ // pass or at runtime.
566
+ },
560
567
 
561
- __exports__.MustacheNode = MustacheNode;function PartialNode(partialName, context, strip) {
562
- this.type = "partial";
563
- this.partialName = partialName;
564
- this.context = context;
565
- this.strip = strip;
566
- }
568
+ PartialNode: function(partialName, context, strip) {
569
+ this.type = "partial";
570
+ this.partialName = partialName;
571
+ this.context = context;
572
+ this.strip = strip;
573
+ },
567
574
 
568
- __exports__.PartialNode = PartialNode;function BlockNode(mustache, program, inverse, close) {
569
- if(mustache.id.original !== close.path.original) {
570
- throw new Exception(mustache.id.original + " doesn't match " + close.path.original);
571
- }
575
+ BlockNode: function(mustache, program, inverse, close) {
576
+ if(mustache.id.original !== close.path.original) {
577
+ throw new Exception(mustache.id.original + " doesn't match " + close.path.original);
578
+ }
572
579
 
573
- this.type = "block";
574
- this.mustache = mustache;
575
- this.program = program;
576
- this.inverse = inverse;
580
+ this.type = "block";
581
+ this.mustache = mustache;
582
+ this.program = program;
583
+ this.inverse = inverse;
577
584
 
578
- this.strip = {
579
- left: mustache.strip.left,
580
- right: close.strip.right
581
- };
585
+ this.strip = {
586
+ left: mustache.strip.left,
587
+ right: close.strip.right
588
+ };
582
589
 
583
- (program || inverse).strip.left = mustache.strip.right;
584
- (inverse || program).strip.right = close.strip.left;
590
+ (program || inverse).strip.left = mustache.strip.right;
591
+ (inverse || program).strip.right = close.strip.left;
585
592
 
586
- if (inverse && !program) {
587
- this.isInverse = true;
588
- }
589
- }
593
+ if (inverse && !program) {
594
+ this.isInverse = true;
595
+ }
596
+ },
590
597
 
591
- __exports__.BlockNode = BlockNode;function ContentNode(string) {
592
- this.type = "content";
593
- this.string = string;
594
- }
598
+ ContentNode: function(string) {
599
+ this.type = "content";
600
+ this.string = string;
601
+ },
595
602
 
596
- __exports__.ContentNode = ContentNode;function HashNode(pairs) {
597
- this.type = "hash";
598
- this.pairs = pairs;
599
- }
603
+ HashNode: function(pairs) {
604
+ this.type = "hash";
605
+ this.pairs = pairs;
606
+ },
600
607
 
601
- __exports__.HashNode = HashNode;function IdNode(parts) {
602
- this.type = "ID";
608
+ IdNode: function(parts) {
609
+ this.type = "ID";
603
610
 
604
- var original = "",
605
- dig = [],
606
- depth = 0;
611
+ var original = "",
612
+ dig = [],
613
+ depth = 0;
607
614
 
608
- for(var i=0,l=parts.length; i<l; i++) {
609
- var part = parts[i].part;
610
- original += (parts[i].separator || '') + part;
615
+ for(var i=0,l=parts.length; i<l; i++) {
616
+ var part = parts[i].part;
617
+ original += (parts[i].separator || '') + part;
611
618
 
612
- if (part === ".." || part === "." || part === "this") {
613
- if (dig.length > 0) { throw new Exception("Invalid path: " + original); }
614
- else if (part === "..") { depth++; }
615
- else { this.isScoped = true; }
619
+ if (part === ".." || part === "." || part === "this") {
620
+ if (dig.length > 0) { throw new Exception("Invalid path: " + original); }
621
+ else if (part === "..") { depth++; }
622
+ else { this.isScoped = true; }
623
+ }
624
+ else { dig.push(part); }
616
625
  }
617
- else { dig.push(part); }
618
- }
619
626
 
620
- this.original = original;
621
- this.parts = dig;
622
- this.string = dig.join('.');
623
- this.depth = depth;
627
+ this.original = original;
628
+ this.parts = dig;
629
+ this.string = dig.join('.');
630
+ this.depth = depth;
624
631
 
625
- // an ID is simple if it only has one part, and that part is not
626
- // `..` or `this`.
627
- this.isSimple = parts.length === 1 && !this.isScoped && depth === 0;
632
+ // an ID is simple if it only has one part, and that part is not
633
+ // `..` or `this`.
634
+ this.isSimple = parts.length === 1 && !this.isScoped && depth === 0;
628
635
 
629
- this.stringModeValue = this.string;
630
- }
636
+ this.stringModeValue = this.string;
637
+ },
631
638
 
632
- __exports__.IdNode = IdNode;function PartialNameNode(name) {
633
- this.type = "PARTIAL_NAME";
634
- this.name = name.original;
635
- }
639
+ PartialNameNode: function(name) {
640
+ this.type = "PARTIAL_NAME";
641
+ this.name = name.original;
642
+ },
636
643
 
637
- __exports__.PartialNameNode = PartialNameNode;function DataNode(id) {
638
- this.type = "DATA";
639
- this.id = id;
640
- }
644
+ DataNode: function(id) {
645
+ this.type = "DATA";
646
+ this.id = id;
647
+ },
641
648
 
642
- __exports__.DataNode = DataNode;function StringNode(string) {
643
- this.type = "STRING";
644
- this.original =
645
- this.string =
646
- this.stringModeValue = string;
647
- }
649
+ StringNode: function(string) {
650
+ this.type = "STRING";
651
+ this.original =
652
+ this.string =
653
+ this.stringModeValue = string;
654
+ },
648
655
 
649
- __exports__.StringNode = StringNode;function IntegerNode(integer) {
650
- this.type = "INTEGER";
651
- this.original =
652
- this.integer = integer;
653
- this.stringModeValue = Number(integer);
654
- }
656
+ IntegerNode: function(integer) {
657
+ this.type = "INTEGER";
658
+ this.original =
659
+ this.integer = integer;
660
+ this.stringModeValue = Number(integer);
661
+ },
655
662
 
656
- __exports__.IntegerNode = IntegerNode;function BooleanNode(bool) {
657
- this.type = "BOOLEAN";
658
- this.bool = bool;
659
- this.stringModeValue = bool === "true";
660
- }
663
+ BooleanNode: function(bool) {
664
+ this.type = "BOOLEAN";
665
+ this.bool = bool;
666
+ this.stringModeValue = bool === "true";
667
+ },
661
668
 
662
- __exports__.BooleanNode = BooleanNode;function CommentNode(comment) {
663
- this.type = "comment";
664
- this.comment = comment;
665
- }
669
+ CommentNode: function(comment) {
670
+ this.type = "comment";
671
+ this.comment = comment;
672
+ }
673
+ };
666
674
 
667
- __exports__.CommentNode = CommentNode;
675
+ // Must be exported as an object rather than the root of the module as the jison lexer
676
+ // most modify the object to operate properly.
677
+ __exports__ = AST;
668
678
  return __exports__;
669
679
  })(__module5__);
670
680
 
@@ -672,6 +682,7 @@ var __module7__ = (function(__dependency1__) {
672
682
  var __module9__ = (function() {
673
683
  "use strict";
674
684
  var __exports__;
685
+ /* jshint ignore:start */
675
686
  /* Jison generated parser */
676
687
  var handlebars = (function(){
677
688
  var parser = {trace: function trace() { },
@@ -884,8 +895,8 @@ var __module9__ = (function() {
884
895
 
885
896
  function stripFlags(open, close) {
886
897
  return {
887
- left: open[2] === '~',
888
- right: close[0] === '~' || close[1] === '~'
898
+ left: open.charAt(2) === '~',
899
+ right: close.charAt(0) === '~' || close.charAt(1) === '~'
889
900
  };
890
901
  }
891
902
 
@@ -1084,8 +1095,7 @@ var __module9__ = (function() {
1084
1095
  case 1:return 14;
1085
1096
  break;
1086
1097
  case 2:
1087
- if(yy_.yytext.slice(-1) !== "\\") this.popState();
1088
- if(yy_.yytext.slice(-1) === "\\") strip(0,1);
1098
+ this.popState();
1089
1099
  return 14;
1090
1100
 
1091
1101
  break;
@@ -1119,7 +1129,7 @@ var __module9__ = (function() {
1119
1129
  break;
1120
1130
  case 17:return 42;
1121
1131
  break;
1122
- case 18:/*ignore whitespace*/
1132
+ case 18:// ignore whitespace
1123
1133
  break;
1124
1134
  case 19:this.popState(); return 24;
1125
1135
  break;
@@ -1147,13 +1157,14 @@ var __module9__ = (function() {
1147
1157
  break;
1148
1158
  }
1149
1159
  };
1150
- lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s])))/,/^(?:false(?=([~}\s])))/,/^(?:-?[0-9]+(?=([~}\s])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
1160
+ lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s])))/,/^(?:false(?=([~}\s])))/,/^(?:-?[0-9]+(?=([~}\s])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
1151
1161
  lexer.conditions = {"mu":{"rules":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,30],"inclusive":true}};
1152
1162
  return lexer;})()
1153
1163
  parser.lexer = lexer;
1154
1164
  function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
1155
1165
  return new Parser;
1156
1166
  })();__exports__ = handlebars;
1167
+ /* jshint ignore:end */
1157
1168
  return __exports__;
1158
1169
  })();
1159
1170
 
@@ -1218,6 +1229,12 @@ var __module11__ = (function(__dependency1__) {
1218
1229
  }
1219
1230
  },
1220
1231
 
1232
+ compilerInfo: function() {
1233
+ var revision = COMPILER_REVISION,
1234
+ versions = REVISION_CHANGES[revision];
1235
+ return "this.compilerInfo = ["+revision+",'"+versions+"'];\n";
1236
+ },
1237
+
1221
1238
  appendToBuffer: function(string) {
1222
1239
  if (this.environment.isSimple) {
1223
1240
  return "return " + string + ";";
@@ -1351,9 +1368,7 @@ var __module11__ = (function(__dependency1__) {
1351
1368
  var source = this.mergeSource();
1352
1369
 
1353
1370
  if (!this.isChild) {
1354
- var revision = COMPILER_REVISION,
1355
- versions = REVISION_CHANGES[revision];
1356
- source = "this.compilerInfo = ["+revision+",'"+versions+"'];\n"+source;
1371
+ source = this.compilerInfo()+source;
1357
1372
  }
1358
1373
 
1359
1374
  if (asObject) {
@@ -2555,6 +2570,7 @@ var __module10__ = (function(__dependency1__, __dependency2__, __dependency3__,
2555
2570
  var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
2556
2571
  "use strict";
2557
2572
  var __exports__;
2573
+ /*globals Handlebars: true */
2558
2574
  var Handlebars = __dependency1__;
2559
2575
 
2560
2576
  // Compiler imports
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
 
3
- handlebars v1.1.2
3
+ handlebars v1.2.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
  }
@@ -149,11 +151,10 @@ var __module4__ = (function() {
149
151
  var __module1__ = (function(__dependency1__, __dependency2__) {
150
152
  "use strict";
151
153
  var __exports__ = {};
152
- /*globals Exception, Utils */
153
154
  var Utils = __dependency1__;
154
155
  var Exception = __dependency2__;
155
156
 
156
- var VERSION = "1.1.2";
157
+ var VERSION = "1.2.0";
157
158
  __exports__.VERSION = VERSION;var COMPILER_REVISION = 4;
158
159
  __exports__.COMPILER_REVISION = COMPILER_REVISION;
159
160
  var REVISION_CHANGES = {
@@ -244,7 +245,7 @@ var __module1__ = (function(__dependency1__, __dependency2__) {
244
245
  for(var j = context.length; i<j; i++) {
245
246
  if (data) {
246
247
  data.index = i;
247
- data.first = (i === 0)
248
+ data.first = (i === 0);
248
249
  data.last = (i === (context.length-1));
249
250
  }
250
251
  ret = ret + fn(context[i], { data: data });
@@ -252,7 +253,11 @@ var __module1__ = (function(__dependency1__, __dependency2__) {
252
253
  } else {
253
254
  for(var key in context) {
254
255
  if(context.hasOwnProperty(key)) {
255
- if(data) { data.key = key; }
256
+ if(data) {
257
+ data.key = key;
258
+ data.index = i;
259
+ data.first = (i === 0);
260
+ }
256
261
  ret = ret + fn(context[key], {data: data});
257
262
  i++;
258
263
  }
@@ -332,7 +337,6 @@ var __module1__ = (function(__dependency1__, __dependency2__) {
332
337
  var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
333
338
  "use strict";
334
339
  var __exports__ = {};
335
- /*global Utils */
336
340
  var Utils = __dependency1__;
337
341
  var Exception = __dependency2__;
338
342
  var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
@@ -356,32 +360,27 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
356
360
  }
357
361
  }
358
362
 
359
- // TODO: Remove this line and break up compilePartial
363
+ __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
360
364
 
361
365
  function template(templateSpec, env) {
362
366
  if (!env) {
363
367
  throw new Error("No environment passed to template");
364
368
  }
365
369
 
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; }
370
+ // Note: Using env.VM references rather than local var references throughout this section to allow
371
+ // for external users to override these as psuedo-supported APIs.
372
+ var invokePartialWrapper = function(partial, name, context, helpers, partials, data) {
373
+ var result = env.VM.invokePartial.apply(this, arguments);
374
+ if (result != null) { return result; }
373
375
 
376
+ if (env.compile) {
374
377
  var options = { helpers: helpers, partials: partials, data: data };
375
378
  partials[name] = env.compile(partial, { data: data !== undefined }, env);
376
379
  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; }
380
+ } else {
382
381
  throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
383
- };
384
- }
382
+ }
383
+ };
385
384
 
386
385
  // Just add water
387
386
  var container = {
@@ -407,8 +406,8 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
407
406
  }
408
407
  return ret;
409
408
  },
410
- programWithDepth: programWithDepth,
411
- noop: noop,
409
+ programWithDepth: env.VM.programWithDepth,
410
+ noop: env.VM.noop,
412
411
  compilerInfo: null
413
412
  };
414
413
 
@@ -430,7 +429,7 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
430
429
  options.data);
431
430
 
432
431
  if (!options.partial) {
433
- checkRevision(container.compilerInfo);
432
+ env.VM.checkRevision(container.compilerInfo);
434
433
  }
435
434
 
436
435
  return result;
@@ -481,6 +480,7 @@ var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
481
480
  var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
482
481
  "use strict";
483
482
  var __exports__;
483
+ /*globals Handlebars: true */
484
484
  var base = __dependency1__;
485
485
 
486
486
  // 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-source
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-25 00:00:00.000000000 Z
11
+ date: 2013-12-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Handlebars.js source code wrapper for (pre)compilation gems.
14
14
  email:
@@ -39,9 +39,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  version: '0'
40
40
  requirements: []
41
41
  rubyforge_project:
42
- rubygems_version: 2.0.6
42
+ rubygems_version: 2.0.3
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: Handlebars.js source code wrapper
46
46
  test_files: []
47
- has_rdoc: