handlebars_assets 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,10 @@
1
1
  ## On master
2
2
 
3
+ ## 0.8.2
4
+
5
+ * Update to [this commit](https://github.com/wycats/handlebars.js/commit/5e5f0dce9c352f490f1f1e58fd7d0f76dd006cac) of `handlebars.js`
6
+ * Fix to allow Ember.js template support when not using Rails
7
+
3
8
  ## 0.8.1
4
9
 
5
10
  * Require haml directly
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- handlebars_assets (0.8.1)
4
+ handlebars_assets (0.8.2)
5
5
  execjs (>= 1.2.9)
6
6
  sprockets (>= 2.0.3)
7
7
  tilt
data/README.md CHANGED
@@ -10,7 +10,7 @@ Using `sprockets` with Sinatra or another framework? **handlebars_assets** works
10
10
 
11
11
  **Please read**
12
12
 
13
- Because of a serious regression introduced in RC1, `handlebars_assets` is packaged with an edge build of `handlebars.js` (this [commit](https://github.com/wycats/handlebars.js/commit/bd0490145438e8f9df05abd2f4c25687bac81326). See the section on using another version if that does not work for you.
13
+ Because of a serious regression introduced in RC1, `handlebars_assets` is packaged with an edge build of `handlebars.js` (this [commit](https://github.com/wycats/handlebars.js/commit/5e5f0dce9c352f490f1f1e58fd7d0f76dd006cac). See the section on using another version if that does not work for you.
14
14
 
15
15
  ## Installation with Rails 3.1+
16
16
 
@@ -29,7 +29,7 @@ module HandlebarsAssets
29
29
  end
30
30
 
31
31
  if HandlebarsAssets::Config.ember?
32
- "window.Ember.TEMPLATES[#{template_path.name}] = Ember.Handlebars.compile(#{source.to_json});"
32
+ "window.Ember.TEMPLATES[#{template_path.name}] = Ember.Handlebars.compile(#{MultiJson.dump source});"
33
33
  else
34
34
  compiled_hbs = Handlebars.precompile(source, HandlebarsAssets::Config.options)
35
35
 
@@ -1,3 +1,3 @@
1
1
  module HandlebarsAssets
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
@@ -62,6 +62,24 @@ Handlebars.createFrame = Object.create || function(object) {
62
62
  return obj;
63
63
  };
64
64
 
65
+ Handlebars.logger = {
66
+ DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
67
+
68
+ methodMap: {0: 'debug', 1: 'info', 2: 'warn', 3: 'error'},
69
+
70
+ // can be overridden in the host environment
71
+ log: function(level, obj) {
72
+ if (Handlebars.logger.level <= level) {
73
+ var method = Handlebars.logger.methodMap[level];
74
+ if (typeof console !== 'undefined' && console[method]) {
75
+ console[method].call(console, obj);
76
+ }
77
+ }
78
+ }
79
+ };
80
+
81
+ Handlebars.log = function(level, obj) { Handlebars.logger.log(level, obj); };
82
+
65
83
  Handlebars.registerHelper('each', function(context, options) {
66
84
  var fn = options.fn, inverse = options.inverse;
67
85
  var i = 0, ret = "", data;
@@ -117,8 +135,9 @@ Handlebars.registerHelper('with', function(context, options) {
117
135
  return options.fn(context);
118
136
  });
119
137
 
120
- Handlebars.registerHelper('log', function(context) {
121
- Handlebars.log(context);
138
+ Handlebars.registerHelper('log', function(context, options) {
139
+ var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
140
+ Handlebars.log(level, context);
122
141
  });
123
142
 
124
143
  }(this.Handlebars));
@@ -128,103 +147,111 @@ Handlebars.registerHelper('log', function(context) {
128
147
  var handlebars = (function(){
129
148
  var parser = {trace: function trace() { },
130
149
  yy: {},
131
- symbols_: {"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"DATA":27,"param":28,"STRING":29,"INTEGER":30,"BOOLEAN":31,"hashSegments":32,"hashSegment":33,"ID":34,"EQUALS":35,"pathSegments":36,"SEP":37,"$accept":0,"$end":1},
132
- terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",27:"DATA",29:"STRING",30:"INTEGER",31:"BOOLEAN",34:"ID",35:"EQUALS",37:"SEP"},
133
- productions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[17,1],[25,2],[25,1],[28,1],[28,1],[28,1],[28,1],[28,1],[26,1],[32,2],[32,1],[33,3],[33,3],[33,3],[33,3],[33,3],[21,1],[36,3],[36,1]],
150
+ symbols_: {"error":2,"root":3,"program":4,"EOF":5,"simpleInverse":6,"statements":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"partialName":25,"params":26,"hash":27,"DATA":28,"param":29,"STRING":30,"INTEGER":31,"BOOLEAN":32,"hashSegments":33,"hashSegment":34,"ID":35,"EQUALS":36,"PARTIAL_NAME":37,"pathSegments":38,"SEP":39,"$accept":0,"$end":1},
151
+ terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"DATA",30:"STRING",31:"INTEGER",32:"BOOLEAN",35:"ID",36:"EQUALS",37:"PARTIAL_NAME",39:"SEP"},
152
+ productions_: [0,[3,2],[4,2],[4,3],[4,2],[4,1],[4,1],[4,0],[7,1],[7,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[6,2],[17,3],[17,2],[17,2],[17,1],[17,1],[26,2],[26,1],[29,1],[29,1],[29,1],[29,1],[29,1],[27,1],[33,2],[33,1],[34,3],[34,3],[34,3],[34,3],[34,3],[25,1],[21,1],[38,3],[38,1]],
134
153
  performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
135
154
 
136
155
  var $0 = $$.length - 1;
137
156
  switch (yystate) {
138
157
  case 1: return $$[$0-1];
139
158
  break;
140
- case 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0]);
159
+ case 2: this.$ = new yy.ProgramNode([], $$[$0]);
141
160
  break;
142
- case 3: this.$ = new yy.ProgramNode($$[$0]);
161
+ case 3: this.$ = new yy.ProgramNode($$[$0-2], $$[$0]);
143
162
  break;
144
- case 4: this.$ = new yy.ProgramNode([]);
163
+ case 4: this.$ = new yy.ProgramNode($$[$0-1], []);
145
164
  break;
146
- case 5: this.$ = [$$[$0]];
165
+ case 5: this.$ = new yy.ProgramNode($$[$0]);
147
166
  break;
148
- case 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
167
+ case 6: this.$ = new yy.ProgramNode([], []);
149
168
  break;
150
- case 7: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]);
169
+ case 7: this.$ = new yy.ProgramNode([]);
151
170
  break;
152
- case 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]);
171
+ case 8: this.$ = [$$[$0]];
153
172
  break;
154
- case 9: this.$ = $$[$0];
173
+ case 9: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
155
174
  break;
156
- case 10: this.$ = $$[$0];
175
+ case 10: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]);
157
176
  break;
158
- case 11: this.$ = new yy.ContentNode($$[$0]);
177
+ case 11: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]);
159
178
  break;
160
- case 12: this.$ = new yy.CommentNode($$[$0]);
179
+ case 12: this.$ = $$[$0];
161
180
  break;
162
- case 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
181
+ case 13: this.$ = $$[$0];
163
182
  break;
164
- case 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
183
+ case 14: this.$ = new yy.ContentNode($$[$0]);
165
184
  break;
166
- case 15: this.$ = $$[$0-1];
185
+ case 15: this.$ = new yy.CommentNode($$[$0]);
167
186
  break;
168
187
  case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
169
188
  break;
170
- case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true);
189
+ case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
190
+ break;
191
+ case 18: this.$ = $$[$0-1];
192
+ break;
193
+ case 19: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
194
+ break;
195
+ case 20: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true);
171
196
  break;
172
- case 18: this.$ = new yy.PartialNode($$[$0-1]);
197
+ case 21: this.$ = new yy.PartialNode($$[$0-1]);
173
198
  break;
174
- case 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1]);
199
+ case 22: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1]);
175
200
  break;
176
- case 20:
201
+ case 23:
177
202
  break;
178
- case 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]];
203
+ case 24: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]];
179
204
  break;
180
- case 22: this.$ = [[$$[$0-1]].concat($$[$0]), null];
205
+ case 25: this.$ = [[$$[$0-1]].concat($$[$0]), null];
181
206
  break;
182
- case 23: this.$ = [[$$[$0-1]], $$[$0]];
207
+ case 26: this.$ = [[$$[$0-1]], $$[$0]];
183
208
  break;
184
- case 24: this.$ = [[$$[$0]], null];
209
+ case 27: this.$ = [[$$[$0]], null];
185
210
  break;
186
- case 25: this.$ = [[new yy.DataNode($$[$0])], null];
211
+ case 28: this.$ = [[new yy.DataNode($$[$0])], null];
187
212
  break;
188
- case 26: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
213
+ case 29: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
189
214
  break;
190
- case 27: this.$ = [$$[$0]];
215
+ case 30: this.$ = [$$[$0]];
191
216
  break;
192
- case 28: this.$ = $$[$0];
217
+ case 31: this.$ = $$[$0];
193
218
  break;
194
- case 29: this.$ = new yy.StringNode($$[$0]);
219
+ case 32: this.$ = new yy.StringNode($$[$0]);
195
220
  break;
196
- case 30: this.$ = new yy.IntegerNode($$[$0]);
221
+ case 33: this.$ = new yy.IntegerNode($$[$0]);
197
222
  break;
198
- case 31: this.$ = new yy.BooleanNode($$[$0]);
223
+ case 34: this.$ = new yy.BooleanNode($$[$0]);
199
224
  break;
200
- case 32: this.$ = new yy.DataNode($$[$0]);
225
+ case 35: this.$ = new yy.DataNode($$[$0]);
201
226
  break;
202
- case 33: this.$ = new yy.HashNode($$[$0]);
227
+ case 36: this.$ = new yy.HashNode($$[$0]);
203
228
  break;
204
- case 34: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
229
+ case 37: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
205
230
  break;
206
- case 35: this.$ = [$$[$0]];
231
+ case 38: this.$ = [$$[$0]];
207
232
  break;
208
- case 36: this.$ = [$$[$0-2], $$[$0]];
233
+ case 39: this.$ = [$$[$0-2], $$[$0]];
209
234
  break;
210
- case 37: this.$ = [$$[$0-2], new yy.StringNode($$[$0])];
235
+ case 40: this.$ = [$$[$0-2], new yy.StringNode($$[$0])];
211
236
  break;
212
- case 38: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])];
237
+ case 41: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])];
213
238
  break;
214
- case 39: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])];
239
+ case 42: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])];
215
240
  break;
216
- case 40: this.$ = [$$[$0-2], new yy.DataNode($$[$0])];
241
+ case 43: this.$ = [$$[$0-2], new yy.DataNode($$[$0])];
217
242
  break;
218
- case 41: this.$ = new yy.IdNode($$[$0]);
243
+ case 44: this.$ = new yy.PartialNameNode($$[$0]);
219
244
  break;
220
- case 42: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];
245
+ case 45: this.$ = new yy.IdNode($$[$0]);
221
246
  break;
222
- case 43: this.$ = [$$[$0]];
247
+ case 46: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];
248
+ break;
249
+ case 47: this.$ = [$$[$0]];
223
250
  break;
224
251
  }
225
252
  },
226
- table: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,27:[1,24],34:[1,26],36:25},{17:27,21:23,27:[1,24],34:[1,26],36:25},{17:28,21:23,27:[1,24],34:[1,26],36:25},{17:29,21:23,27:[1,24],34:[1,26],36:25},{21:30,34:[1,26],36:25},{1:[2,1]},{6:31,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,32],21:23,27:[1,24],34:[1,26],36:25},{10:33,20:[1,34]},{10:35,20:[1,34]},{18:[1,36]},{18:[2,24],21:41,25:37,26:38,27:[1,45],28:39,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,25]},{18:[2,41],27:[2,41],29:[2,41],30:[2,41],31:[2,41],34:[2,41],37:[1,48]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],37:[2,43]},{18:[1,49]},{18:[1,50]},{18:[1,51]},{18:[1,52],21:53,34:[1,26],36:25},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:54,34:[1,26],36:25},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:41,26:55,27:[1,45],28:56,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,23]},{18:[2,27],27:[2,27],29:[2,27],30:[2,27],31:[2,27],34:[2,27]},{18:[2,33],33:57,34:[1,58]},{18:[2,28],27:[2,28],29:[2,28],30:[2,28],31:[2,28],34:[2,28]},{18:[2,29],27:[2,29],29:[2,29],30:[2,29],31:[2,29],34:[2,29]},{18:[2,30],27:[2,30],29:[2,30],30:[2,30],31:[2,30],34:[2,30]},{18:[2,31],27:[2,31],29:[2,31],30:[2,31],31:[2,31],34:[2,31]},{18:[2,32],27:[2,32],29:[2,32],30:[2,32],31:[2,32],34:[2,32]},{18:[2,35],34:[2,35]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],35:[1,59],37:[2,43]},{34:[1,60]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,61]},{18:[1,62]},{18:[2,21]},{18:[2,26],27:[2,26],29:[2,26],30:[2,26],31:[2,26],34:[2,26]},{18:[2,34],34:[2,34]},{35:[1,59]},{21:63,27:[1,67],29:[1,64],30:[1,65],31:[1,66],34:[1,26],36:25},{18:[2,42],27:[2,42],29:[2,42],30:[2,42],31:[2,42],34:[2,42],37:[2,42]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,36],34:[2,36]},{18:[2,37],34:[2,37]},{18:[2,38],34:[2,38]},{18:[2,39],34:[2,39]},{18:[2,40],34:[2,40]}],
227
- defaultActions: {16:[2,1],24:[2,25],38:[2,23],55:[2,21]},
253
+ table: [{3:1,4:2,5:[2,7],6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],22:[1,14],23:[1,15],24:[1,16]},{1:[3]},{5:[1,17]},{5:[2,6],7:18,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,6],22:[1,14],23:[1,15],24:[1,16]},{5:[2,5],6:20,8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,5],22:[1,14],23:[1,15],24:[1,16]},{17:23,18:[1,22],21:24,28:[1,25],35:[1,27],38:26},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{4:28,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],24:[1,16]},{4:29,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],24:[1,16]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{17:30,21:24,28:[1,25],35:[1,27],38:26},{17:31,21:24,28:[1,25],35:[1,27],38:26},{17:32,21:24,28:[1,25],35:[1,27],38:26},{25:33,37:[1,34]},{1:[2,1]},{5:[2,2],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,2],22:[1,14],23:[1,15],24:[1,16]},{17:23,21:24,28:[1,25],35:[1,27],38:26},{5:[2,4],7:35,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,4],22:[1,14],23:[1,15],24:[1,16]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,23],14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],24:[2,23]},{18:[1,36]},{18:[2,27],21:41,26:37,27:38,28:[1,45],29:39,30:[1,42],31:[1,43],32:[1,44],33:40,34:46,35:[1,47],38:26},{18:[2,28]},{18:[2,45],28:[2,45],30:[2,45],31:[2,45],32:[2,45],35:[2,45],39:[1,48]},{18:[2,47],28:[2,47],30:[2,47],31:[2,47],32:[2,47],35:[2,47],39:[2,47]},{10:49,20:[1,50]},{10:51,20:[1,50]},{18:[1,52]},{18:[1,53]},{18:[1,54]},{18:[1,55],21:56,35:[1,27],38:26},{18:[2,44],35:[2,44]},{5:[2,3],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,3],22:[1,14],23:[1,15],24:[1,16]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{18:[2,25],21:41,27:57,28:[1,45],29:58,30:[1,42],31:[1,43],32:[1,44],33:40,34:46,35:[1,47],38:26},{18:[2,26]},{18:[2,30],28:[2,30],30:[2,30],31:[2,30],32:[2,30],35:[2,30]},{18:[2,36],34:59,35:[1,60]},{18:[2,31],28:[2,31],30:[2,31],31:[2,31],32:[2,31],35:[2,31]},{18:[2,32],28:[2,32],30:[2,32],31:[2,32],32:[2,32],35:[2,32]},{18:[2,33],28:[2,33],30:[2,33],31:[2,33],32:[2,33],35:[2,33]},{18:[2,34],28:[2,34],30:[2,34],31:[2,34],32:[2,34],35:[2,34]},{18:[2,35],28:[2,35],30:[2,35],31:[2,35],32:[2,35],35:[2,35]},{18:[2,38],35:[2,38]},{18:[2,47],28:[2,47],30:[2,47],31:[2,47],32:[2,47],35:[2,47],36:[1,61],39:[2,47]},{35:[1,62]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{21:63,35:[1,27],38:26},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],24:[2,21]},{18:[1,64]},{18:[2,24]},{18:[2,29],28:[2,29],30:[2,29],31:[2,29],32:[2,29],35:[2,29]},{18:[2,37],35:[2,37]},{36:[1,61]},{21:65,28:[1,69],30:[1,66],31:[1,67],32:[1,68],35:[1,27],38:26},{18:[2,46],28:[2,46],30:[2,46],31:[2,46],32:[2,46],35:[2,46],39:[2,46]},{18:[1,70]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],24:[2,22]},{18:[2,39],35:[2,39]},{18:[2,40],35:[2,40]},{18:[2,41],35:[2,41]},{18:[2,42],35:[2,42]},{18:[2,43],35:[2,43]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]}],
254
+ defaultActions: {17:[2,1],25:[2,28],38:[2,26],57:[2,24]},
228
255
  parseError: function parseError(str, hash) {
229
256
  throw new Error(str);
230
257
  },
@@ -521,7 +548,7 @@ case 2:
521
548
  break;
522
549
  case 3: yy_.yytext = yy_.yytext.substr(0, yy_.yyleng-4); this.popState(); return 15;
523
550
  break;
524
- case 4: return 24;
551
+ case 4: this.begin("par"); return 24;
525
552
  break;
526
553
  case 5: return 16;
527
554
  break;
@@ -541,13 +568,13 @@ case 12: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return
541
568
  break;
542
569
  case 13: return 22;
543
570
  break;
544
- case 14: return 35;
571
+ case 14: return 36;
545
572
  break;
546
- case 15: return 34;
573
+ case 15: return 35;
547
574
  break;
548
- case 16: return 34;
575
+ case 16: return 35;
549
576
  break;
550
- case 17: return 37;
577
+ case 17: return 39;
551
578
  break;
552
579
  case 18: /*ignore whitespace*/
553
580
  break;
@@ -555,55 +582,39 @@ case 19: this.popState(); return 18;
555
582
  break;
556
583
  case 20: this.popState(); return 18;
557
584
  break;
558
- case 21: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 29;
585
+ case 21: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 30;
559
586
  break;
560
- case 22: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\'/g,"'"); return 29;
587
+ case 22: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\'/g,"'"); return 30;
561
588
  break;
562
- case 23: yy_.yytext = yy_.yytext.substr(1); return 27;
589
+ case 23: yy_.yytext = yy_.yytext.substr(1); return 28;
563
590
  break;
564
- case 24: return 31;
591
+ case 24: return 32;
565
592
  break;
566
- case 25: return 31;
593
+ case 25: return 32;
567
594
  break;
568
- case 26: return 30;
595
+ case 26: return 31;
569
596
  break;
570
- case 27: return 34;
597
+ case 27: return 35;
571
598
  break;
572
- case 28: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 34;
599
+ case 28: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 35;
573
600
  break;
574
601
  case 29: return 'INVALID';
575
602
  break;
576
- case 30: return 5;
603
+ case 30: /*ignore whitespace*/
604
+ break;
605
+ case 31: this.popState(); return 37;
606
+ break;
607
+ case 32: return 5;
577
608
  break;
578
609
  }
579
610
  };
580
- lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
581
- 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}};
611
+ lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:\s+)/,/^(?:[a-zA-Z0-9_$-/]+)/,/^(?:$)/];
612
+ 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,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"par":{"rules":[30,31],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}};
582
613
  return lexer;})()
583
614
  parser.lexer = lexer;
584
615
  function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
585
616
  return new Parser;
586
- })();
587
- if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
588
- exports.parser = handlebars;
589
- exports.Parser = handlebars.Parser;
590
- exports.parse = function () { return handlebars.parse.apply(handlebars, arguments); }
591
- exports.main = function commonjsMain(args) {
592
- if (!args[1])
593
- throw new Error('Usage: '+args[0]+' FILE');
594
- var source, cwd;
595
- if (typeof process !== 'undefined') {
596
- source = require('fs').readFileSync(require('path').resolve(args[1]), "utf8");
597
- } else {
598
- source = require("file").path(require("file").cwd()).join(args[1]).read({charset: "utf-8"});
599
- }
600
- return exports.parser.parse(source);
601
- }
602
- if (typeof module !== 'undefined' && require.main === module) {
603
- exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
604
- }
605
- };
606
- ;
617
+ })();;
607
618
  // lib/handlebars/compiler/base.js
608
619
  Handlebars.Parser = handlebars;
609
620
 
@@ -614,17 +625,7 @@ Handlebars.parse = function(string) {
614
625
 
615
626
  Handlebars.print = function(ast) {
616
627
  return new Handlebars.PrintVisitor().accept(ast);
617
- };
618
-
619
- Handlebars.logger = {
620
- DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
621
-
622
- // override in the host environment
623
- log: function(level, str) {}
624
- };
625
-
626
- Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
627
- ;
628
+ };;
628
629
  // lib/handlebars/compiler/ast.js
629
630
  (function() {
630
631
 
@@ -658,13 +659,10 @@ Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
658
659
  // pass or at runtime.
659
660
  };
660
661
 
661
- Handlebars.AST.PartialNode = function(id, context) {
662
- this.type = "partial";
663
-
664
- // TODO: disallow complex IDs
665
-
666
- this.id = id;
667
- this.context = context;
662
+ Handlebars.AST.PartialNode = function(partialName, context) {
663
+ this.type = "partial";
664
+ this.partialName = partialName;
665
+ this.context = context;
668
666
  };
669
667
 
670
668
  var verifyMatch = function(open, close) {
@@ -718,6 +716,11 @@ Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
718
716
  this.isSimple = parts.length === 1 && !this.isScoped && depth === 0;
719
717
  };
720
718
 
719
+ Handlebars.AST.PartialNameNode = function(name) {
720
+ this.type = "PARTIAL_NAME";
721
+ this.name = name;
722
+ };
723
+
721
724
  Handlebars.AST.DataNode = function(id) {
722
725
  this.type = "DATA";
723
726
  this.id = id;
@@ -797,11 +800,7 @@ Handlebars.SafeString.prototype.toString = function() {
797
800
  },
798
801
 
799
802
  isEmpty: function(value) {
800
- if (typeof value === "undefined") {
801
- return true;
802
- } else if (value === null) {
803
- return true;
804
- } else if (value === false) {
803
+ if (!value && value !== 0) {
805
804
  return true;
806
805
  } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
807
806
  return true;
@@ -971,7 +970,7 @@ Handlebars.JavaScriptCompiler = function() {};
971
970
  },
972
971
 
973
972
  partial: function(partial) {
974
- var id = partial.id;
973
+ var partialName = partial.partialName;
975
974
  this.usePartial = true;
976
975
 
977
976
  if(partial.context) {
@@ -980,7 +979,7 @@ Handlebars.JavaScriptCompiler = function() {};
980
979
  this.opcode('push', 'depth0');
981
980
  }
982
981
 
983
- this.opcode('invokePartial', id.original);
982
+ this.opcode('invokePartial', partialName.name);
984
983
  this.opcode('append');
985
984
  },
986
985
 
@@ -1341,7 +1340,7 @@ Handlebars.JavaScriptCompiler = function() {};
1341
1340
 
1342
1341
  this.replaceStack(function(current) {
1343
1342
  params.splice(1, 0, current);
1344
- return current + " = blockHelperMissing.call(" + params.join(", ") + ")";
1343
+ return "blockHelperMissing.call(" + params.join(", ") + ")";
1345
1344
  });
1346
1345
  },
1347
1346
 
@@ -1616,7 +1615,7 @@ Handlebars.JavaScriptCompiler = function() {};
1616
1615
  }
1617
1616
 
1618
1617
  this.context.aliases.self = "this";
1619
- this.pushStack("self.invokePartial(" + params.join(", ") + ");");
1618
+ this.pushStack("self.invokePartial(" + params.join(", ") + ")");
1620
1619
  },
1621
1620
 
1622
1621
  // [assignToHash]
@@ -1697,21 +1696,28 @@ Handlebars.JavaScriptCompiler = function() {};
1697
1696
  },
1698
1697
 
1699
1698
  pushStack: function(item) {
1700
- this.source.push(this.incrStack() + " = " + item + ";");
1701
- this.compileStack.push("stack" + this.stackSlot);
1702
- return "stack" + this.stackSlot;
1699
+ var stack = this.incrStack();
1700
+ this.source.push(stack + " = " + item + ";");
1701
+ this.compileStack.push(stack);
1702
+ return stack;
1703
1703
  },
1704
1704
 
1705
1705
  replaceStack: function(callback) {
1706
- var item = callback.call(this, this.topStack());
1706
+ var stack = this.topStack(),
1707
+ item = callback.call(this, stack);
1707
1708
 
1708
- this.source.push(this.topStack() + " = " + item + ";");
1709
- return "stack" + this.stackSlot;
1709
+ // Prevent modification of the context depth variable. Through replaceStack
1710
+ if (/^depth/.test(stack)) {
1711
+ stack = this.nextStack();
1712
+ }
1713
+
1714
+ this.source.push(stack + " = " + item + ";");
1715
+ return stack;
1710
1716
  },
1711
1717
 
1712
1718
  nextStack: function(skipCompileStack) {
1713
1719
  var name = this.incrStack();
1714
- this.compileStack.push("stack" + this.stackSlot);
1720
+ this.compileStack.push(name);
1715
1721
  return name;
1716
1722
  },
1717
1723
 
@@ -1846,16 +1852,28 @@ Handlebars.JavaScriptCompiler = function() {};
1846
1852
  })(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
1847
1853
 
1848
1854
  Handlebars.precompile = function(string, options) {
1849
- options = options || {};
1855
+ if (typeof string !== 'string') {
1856
+ throw new Handlebars.Exception("You must pass a string to Handlebars.compile. You passed " + string);
1857
+ }
1850
1858
 
1859
+ options = options || {};
1860
+ if (!('data' in options)) {
1861
+ options.data = true;
1862
+ }
1851
1863
  var ast = Handlebars.parse(string);
1852
1864
  var environment = new Handlebars.Compiler().compile(ast, options);
1853
1865
  return new Handlebars.JavaScriptCompiler().compile(environment, options);
1854
1866
  };
1855
1867
 
1856
1868
  Handlebars.compile = function(string, options) {
1857
- options = options || {};
1869
+ if (typeof string !== 'string') {
1870
+ throw new Handlebars.Exception("You must pass a string to Handlebars.compile. You passed " + string);
1871
+ }
1858
1872
 
1873
+ options = options || {};
1874
+ if (!('data' in options)) {
1875
+ options.data = true;
1876
+ }
1859
1877
  var compiled;
1860
1878
  function compile() {
1861
1879
  var ast = Handlebars.parse(string);
@@ -62,6 +62,24 @@ Handlebars.createFrame = Object.create || function(object) {
62
62
  return obj;
63
63
  };
64
64
 
65
+ Handlebars.logger = {
66
+ DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
67
+
68
+ methodMap: {0: 'debug', 1: 'info', 2: 'warn', 3: 'error'},
69
+
70
+ // can be overridden in the host environment
71
+ log: function(level, obj) {
72
+ if (Handlebars.logger.level <= level) {
73
+ var method = Handlebars.logger.methodMap[level];
74
+ if (typeof console !== 'undefined' && console[method]) {
75
+ console[method].call(console, obj);
76
+ }
77
+ }
78
+ }
79
+ };
80
+
81
+ Handlebars.log = function(level, obj) { Handlebars.logger.log(level, obj); };
82
+
65
83
  Handlebars.registerHelper('each', function(context, options) {
66
84
  var fn = options.fn, inverse = options.inverse;
67
85
  var i = 0, ret = "", data;
@@ -117,8 +135,9 @@ Handlebars.registerHelper('with', function(context, options) {
117
135
  return options.fn(context);
118
136
  });
119
137
 
120
- Handlebars.registerHelper('log', function(context) {
121
- Handlebars.log(context);
138
+ Handlebars.registerHelper('log', function(context, options) {
139
+ var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
140
+ Handlebars.log(level, context);
122
141
  });
123
142
 
124
143
  }(this.Handlebars));
@@ -176,11 +195,7 @@ Handlebars.SafeString.prototype.toString = function() {
176
195
  },
177
196
 
178
197
  isEmpty: function(value) {
179
- if (typeof value === "undefined") {
180
- return true;
181
- } else if (value === null) {
182
- return true;
183
- } else if (value === false) {
198
+ if (!value && value !== 0) {
184
199
  return true;
185
200
  } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
186
201
  return true;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handlebars_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-03 00:00:00.000000000 Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: execjs