sht_rails 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/sht_rails/config.rb +3 -1
- data/lib/sht_rails/tilt.rb +3 -5
- data/lib/sht_rails/version.rb +1 -1
- data/vendor/assets/javascripts/handlebars.js +1550 -1005
- data/vendor/assets/javascripts/handlebars.runtime.js +422 -213
- metadata +3 -3
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
/*!
|
2
|
+
|
3
|
+
handlebars v1.3.0
|
2
4
|
|
3
5
|
Copyright (C) 2011 by Yehuda Katz
|
4
6
|
|
@@ -20,846 +22,1269 @@ 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
|
*/
|
27
|
+
/* exported Handlebars */
|
28
|
+
var Handlebars = (function() {
|
29
|
+
// handlebars/safe-string.js
|
30
|
+
var __module4__ = (function() {
|
31
|
+
"use strict";
|
32
|
+
var __exports__;
|
33
|
+
// Build out our basic SafeString type
|
34
|
+
function SafeString(string) {
|
35
|
+
this.string = string;
|
36
|
+
}
|
24
37
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
this.Handlebars = {};
|
29
|
-
|
30
|
-
(function(Handlebars) {
|
31
|
-
|
32
|
-
Handlebars.VERSION = "1.0.0-rc.3";
|
33
|
-
Handlebars.COMPILER_REVISION = 2;
|
38
|
+
SafeString.prototype.toString = function() {
|
39
|
+
return "" + this.string;
|
40
|
+
};
|
34
41
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
};
|
42
|
+
__exports__ = SafeString;
|
43
|
+
return __exports__;
|
44
|
+
})();
|
39
45
|
|
40
|
-
|
41
|
-
|
46
|
+
// handlebars/utils.js
|
47
|
+
var __module3__ = (function(__dependency1__) {
|
48
|
+
"use strict";
|
49
|
+
var __exports__ = {};
|
50
|
+
/*jshint -W004 */
|
51
|
+
var SafeString = __dependency1__;
|
42
52
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
53
|
+
var escape = {
|
54
|
+
"&": "&",
|
55
|
+
"<": "<",
|
56
|
+
">": ">",
|
57
|
+
'"': """,
|
58
|
+
"'": "'",
|
59
|
+
"`": "`"
|
60
|
+
};
|
47
61
|
|
48
|
-
|
49
|
-
|
50
|
-
};
|
62
|
+
var badChars = /[&<>"'`]/g;
|
63
|
+
var possible = /[&<>"'`]/;
|
51
64
|
|
52
|
-
|
53
|
-
|
54
|
-
return undefined;
|
55
|
-
} else {
|
56
|
-
throw new Error("Could not find property '" + arg + "'");
|
65
|
+
function escapeChar(chr) {
|
66
|
+
return escape[chr] || "&";
|
57
67
|
}
|
58
|
-
});
|
59
|
-
|
60
|
-
var toString = Object.prototype.toString, functionType = "[object Function]";
|
61
68
|
|
62
|
-
|
63
|
-
|
69
|
+
function extend(obj, value) {
|
70
|
+
for(var key in value) {
|
71
|
+
if(Object.prototype.hasOwnProperty.call(value, key)) {
|
72
|
+
obj[key] = value[key];
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
64
76
|
|
77
|
+
__exports__.extend = extend;var toString = Object.prototype.toString;
|
78
|
+
__exports__.toString = toString;
|
79
|
+
// Sourced from lodash
|
80
|
+
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
|
81
|
+
var isFunction = function(value) {
|
82
|
+
return typeof value === 'function';
|
83
|
+
};
|
84
|
+
// fallback for older versions of Chrome and Safari
|
85
|
+
if (isFunction(/x/)) {
|
86
|
+
isFunction = function(value) {
|
87
|
+
return typeof value === 'function' && toString.call(value) === '[object Function]';
|
88
|
+
};
|
89
|
+
}
|
90
|
+
var isFunction;
|
91
|
+
__exports__.isFunction = isFunction;
|
92
|
+
var isArray = Array.isArray || function(value) {
|
93
|
+
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
|
94
|
+
};
|
95
|
+
__exports__.isArray = isArray;
|
96
|
+
|
97
|
+
function escapeExpression(string) {
|
98
|
+
// don't escape SafeStrings, since they're already safe
|
99
|
+
if (string instanceof SafeString) {
|
100
|
+
return string.toString();
|
101
|
+
} else if (!string && string !== 0) {
|
102
|
+
return "";
|
103
|
+
}
|
65
104
|
|
66
|
-
|
67
|
-
|
105
|
+
// Force a string conversion as this will be done by the append regardless and
|
106
|
+
// the regex test will do this transparently behind the scenes, causing issues if
|
107
|
+
// an object's to string has escaped characters in it.
|
108
|
+
string = "" + string;
|
68
109
|
|
69
|
-
|
110
|
+
if(!possible.test(string)) { return string; }
|
111
|
+
return string.replace(badChars, escapeChar);
|
112
|
+
}
|
70
113
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
if(context.length > 0) {
|
77
|
-
return Handlebars.helpers.each(context, options);
|
114
|
+
__exports__.escapeExpression = escapeExpression;function isEmpty(value) {
|
115
|
+
if (!value && value !== 0) {
|
116
|
+
return true;
|
117
|
+
} else if (isArray(value) && value.length === 0) {
|
118
|
+
return true;
|
78
119
|
} else {
|
79
|
-
return
|
120
|
+
return false;
|
80
121
|
}
|
81
|
-
} else {
|
82
|
-
return fn(context);
|
83
122
|
}
|
84
|
-
});
|
85
123
|
|
86
|
-
|
124
|
+
__exports__.isEmpty = isEmpty;
|
125
|
+
return __exports__;
|
126
|
+
})(__module4__);
|
87
127
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
return obj;
|
93
|
-
};
|
128
|
+
// handlebars/exception.js
|
129
|
+
var __module5__ = (function() {
|
130
|
+
"use strict";
|
131
|
+
var __exports__;
|
94
132
|
|
95
|
-
|
96
|
-
DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
|
133
|
+
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
|
97
134
|
|
98
|
-
|
135
|
+
function Exception(message, node) {
|
136
|
+
var line;
|
137
|
+
if (node && node.firstLine) {
|
138
|
+
line = node.firstLine;
|
99
139
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
140
|
+
message += ' - ' + line + ':' + node.firstColumn;
|
141
|
+
}
|
142
|
+
|
143
|
+
var tmp = Error.prototype.constructor.call(this, message);
|
144
|
+
|
145
|
+
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
|
146
|
+
for (var idx = 0; idx < errorProps.length; idx++) {
|
147
|
+
this[errorProps[idx]] = tmp[errorProps[idx]];
|
148
|
+
}
|
149
|
+
|
150
|
+
if (line) {
|
151
|
+
this.lineNumber = line;
|
152
|
+
this.column = node.firstColumn;
|
107
153
|
}
|
108
154
|
}
|
109
|
-
};
|
110
155
|
|
111
|
-
|
156
|
+
Exception.prototype = new Error();
|
157
|
+
|
158
|
+
__exports__ = Exception;
|
159
|
+
return __exports__;
|
160
|
+
})();
|
161
|
+
|
162
|
+
// handlebars/base.js
|
163
|
+
var __module2__ = (function(__dependency1__, __dependency2__) {
|
164
|
+
"use strict";
|
165
|
+
var __exports__ = {};
|
166
|
+
var Utils = __dependency1__;
|
167
|
+
var Exception = __dependency2__;
|
168
|
+
|
169
|
+
var VERSION = "1.3.0";
|
170
|
+
__exports__.VERSION = VERSION;var COMPILER_REVISION = 4;
|
171
|
+
__exports__.COMPILER_REVISION = COMPILER_REVISION;
|
172
|
+
var REVISION_CHANGES = {
|
173
|
+
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
|
174
|
+
2: '== 1.0.0-rc.3',
|
175
|
+
3: '== 1.0.0-rc.4',
|
176
|
+
4: '>= 1.0.0'
|
177
|
+
};
|
178
|
+
__exports__.REVISION_CHANGES = REVISION_CHANGES;
|
179
|
+
var isArray = Utils.isArray,
|
180
|
+
isFunction = Utils.isFunction,
|
181
|
+
toString = Utils.toString,
|
182
|
+
objectType = '[object Object]';
|
112
183
|
|
113
|
-
|
114
|
-
|
115
|
-
|
184
|
+
function HandlebarsEnvironment(helpers, partials) {
|
185
|
+
this.helpers = helpers || {};
|
186
|
+
this.partials = partials || {};
|
116
187
|
|
117
|
-
|
118
|
-
data = Handlebars.createFrame(options.data);
|
188
|
+
registerDefaultHelpers(this);
|
119
189
|
}
|
120
190
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
191
|
+
__exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
|
192
|
+
constructor: HandlebarsEnvironment,
|
193
|
+
|
194
|
+
logger: logger,
|
195
|
+
log: log,
|
196
|
+
|
197
|
+
registerHelper: function(name, fn, inverse) {
|
198
|
+
if (toString.call(name) === objectType) {
|
199
|
+
if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); }
|
200
|
+
Utils.extend(this.helpers, name);
|
201
|
+
} else {
|
202
|
+
if (inverse) { fn.not = inverse; }
|
203
|
+
this.helpers[name] = fn;
|
126
204
|
}
|
127
|
-
}
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
205
|
+
},
|
206
|
+
|
207
|
+
registerPartial: function(name, str) {
|
208
|
+
if (toString.call(name) === objectType) {
|
209
|
+
Utils.extend(this.partials, name);
|
210
|
+
} else {
|
211
|
+
this.partials[name] = str;
|
134
212
|
}
|
135
213
|
}
|
136
|
-
}
|
214
|
+
};
|
137
215
|
|
138
|
-
|
139
|
-
|
140
|
-
|
216
|
+
function registerDefaultHelpers(instance) {
|
217
|
+
instance.registerHelper('helperMissing', function(arg) {
|
218
|
+
if(arguments.length === 2) {
|
219
|
+
return undefined;
|
220
|
+
} else {
|
221
|
+
throw new Exception("Missing helper: '" + arg + "'");
|
222
|
+
}
|
223
|
+
});
|
141
224
|
|
142
|
-
|
143
|
-
}
|
225
|
+
instance.registerHelper('blockHelperMissing', function(context, options) {
|
226
|
+
var inverse = options.inverse || function() {}, fn = options.fn;
|
144
227
|
|
145
|
-
|
146
|
-
var type = toString.call(context);
|
147
|
-
if(type === functionType) { context = context.call(this); }
|
228
|
+
if (isFunction(context)) { context = context.call(this); }
|
148
229
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
options.fn = inverse;
|
159
|
-
options.inverse = fn;
|
160
|
-
|
161
|
-
return Handlebars.helpers['if'].call(this, context, options);
|
162
|
-
});
|
163
|
-
|
164
|
-
Handlebars.registerHelper('with', function(context, options) {
|
165
|
-
return options.fn(context);
|
166
|
-
});
|
167
|
-
|
168
|
-
Handlebars.registerHelper('log', function(context, options) {
|
169
|
-
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
|
170
|
-
Handlebars.log(level, context);
|
171
|
-
});
|
172
|
-
|
173
|
-
}(this.Handlebars));
|
174
|
-
;
|
175
|
-
// lib/handlebars/compiler/parser.js
|
176
|
-
/* Jison generated parser */
|
177
|
-
var handlebars = (function(){
|
178
|
-
var parser = {trace: function trace() { },
|
179
|
-
yy: {},
|
180
|
-
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},
|
181
|
-
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"},
|
182
|
-
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]],
|
183
|
-
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
|
184
|
-
|
185
|
-
var $0 = $$.length - 1;
|
186
|
-
switch (yystate) {
|
187
|
-
case 1: return $$[$0-1];
|
188
|
-
break;
|
189
|
-
case 2: this.$ = new yy.ProgramNode([], $$[$0]);
|
190
|
-
break;
|
191
|
-
case 3: this.$ = new yy.ProgramNode($$[$0-2], $$[$0]);
|
192
|
-
break;
|
193
|
-
case 4: this.$ = new yy.ProgramNode($$[$0-1], []);
|
194
|
-
break;
|
195
|
-
case 5: this.$ = new yy.ProgramNode($$[$0]);
|
196
|
-
break;
|
197
|
-
case 6: this.$ = new yy.ProgramNode([], []);
|
198
|
-
break;
|
199
|
-
case 7: this.$ = new yy.ProgramNode([]);
|
200
|
-
break;
|
201
|
-
case 8: this.$ = [$$[$0]];
|
202
|
-
break;
|
203
|
-
case 9: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
|
204
|
-
break;
|
205
|
-
case 10: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]);
|
206
|
-
break;
|
207
|
-
case 11: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]);
|
208
|
-
break;
|
209
|
-
case 12: this.$ = $$[$0];
|
210
|
-
break;
|
211
|
-
case 13: this.$ = $$[$0];
|
212
|
-
break;
|
213
|
-
case 14: this.$ = new yy.ContentNode($$[$0]);
|
214
|
-
break;
|
215
|
-
case 15: this.$ = new yy.CommentNode($$[$0]);
|
216
|
-
break;
|
217
|
-
case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
|
218
|
-
break;
|
219
|
-
case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
|
220
|
-
break;
|
221
|
-
case 18: this.$ = $$[$0-1];
|
222
|
-
break;
|
223
|
-
case 19: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]);
|
224
|
-
break;
|
225
|
-
case 20: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true);
|
226
|
-
break;
|
227
|
-
case 21: this.$ = new yy.PartialNode($$[$0-1]);
|
228
|
-
break;
|
229
|
-
case 22: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1]);
|
230
|
-
break;
|
231
|
-
case 23:
|
232
|
-
break;
|
233
|
-
case 24: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]];
|
234
|
-
break;
|
235
|
-
case 25: this.$ = [[$$[$0-1]].concat($$[$0]), null];
|
236
|
-
break;
|
237
|
-
case 26: this.$ = [[$$[$0-1]], $$[$0]];
|
238
|
-
break;
|
239
|
-
case 27: this.$ = [[$$[$0]], null];
|
240
|
-
break;
|
241
|
-
case 28: this.$ = [[new yy.DataNode($$[$0])], null];
|
242
|
-
break;
|
243
|
-
case 29: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
|
244
|
-
break;
|
245
|
-
case 30: this.$ = [$$[$0]];
|
246
|
-
break;
|
247
|
-
case 31: this.$ = $$[$0];
|
248
|
-
break;
|
249
|
-
case 32: this.$ = new yy.StringNode($$[$0]);
|
250
|
-
break;
|
251
|
-
case 33: this.$ = new yy.IntegerNode($$[$0]);
|
252
|
-
break;
|
253
|
-
case 34: this.$ = new yy.BooleanNode($$[$0]);
|
254
|
-
break;
|
255
|
-
case 35: this.$ = new yy.DataNode($$[$0]);
|
256
|
-
break;
|
257
|
-
case 36: this.$ = new yy.HashNode($$[$0]);
|
258
|
-
break;
|
259
|
-
case 37: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
|
260
|
-
break;
|
261
|
-
case 38: this.$ = [$$[$0]];
|
262
|
-
break;
|
263
|
-
case 39: this.$ = [$$[$0-2], $$[$0]];
|
264
|
-
break;
|
265
|
-
case 40: this.$ = [$$[$0-2], new yy.StringNode($$[$0])];
|
266
|
-
break;
|
267
|
-
case 41: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])];
|
268
|
-
break;
|
269
|
-
case 42: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])];
|
270
|
-
break;
|
271
|
-
case 43: this.$ = [$$[$0-2], new yy.DataNode($$[$0])];
|
272
|
-
break;
|
273
|
-
case 44: this.$ = new yy.PartialNameNode($$[$0]);
|
274
|
-
break;
|
275
|
-
case 45: this.$ = new yy.IdNode($$[$0]);
|
276
|
-
break;
|
277
|
-
case 46: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];
|
278
|
-
break;
|
279
|
-
case 47: this.$ = [$$[$0]];
|
280
|
-
break;
|
281
|
-
}
|
282
|
-
},
|
283
|
-
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]}],
|
284
|
-
defaultActions: {17:[2,1],25:[2,28],38:[2,26],57:[2,24]},
|
285
|
-
parseError: function parseError(str, hash) {
|
286
|
-
throw new Error(str);
|
287
|
-
},
|
288
|
-
parse: function parse(input) {
|
289
|
-
var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
290
|
-
this.lexer.setInput(input);
|
291
|
-
this.lexer.yy = this.yy;
|
292
|
-
this.yy.lexer = this.lexer;
|
293
|
-
this.yy.parser = this;
|
294
|
-
if (typeof this.lexer.yylloc == "undefined")
|
295
|
-
this.lexer.yylloc = {};
|
296
|
-
var yyloc = this.lexer.yylloc;
|
297
|
-
lstack.push(yyloc);
|
298
|
-
var ranges = this.lexer.options && this.lexer.options.ranges;
|
299
|
-
if (typeof this.yy.parseError === "function")
|
300
|
-
this.parseError = this.yy.parseError;
|
301
|
-
function popStack(n) {
|
302
|
-
stack.length = stack.length - 2 * n;
|
303
|
-
vstack.length = vstack.length - n;
|
304
|
-
lstack.length = lstack.length - n;
|
305
|
-
}
|
306
|
-
function lex() {
|
307
|
-
var token;
|
308
|
-
token = self.lexer.lex() || 1;
|
309
|
-
if (typeof token !== "number") {
|
310
|
-
token = self.symbols_[token] || token;
|
230
|
+
if(context === true) {
|
231
|
+
return fn(this);
|
232
|
+
} else if(context === false || context == null) {
|
233
|
+
return inverse(this);
|
234
|
+
} else if (isArray(context)) {
|
235
|
+
if(context.length > 0) {
|
236
|
+
return instance.helpers.each(context, options);
|
237
|
+
} else {
|
238
|
+
return inverse(this);
|
311
239
|
}
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
240
|
+
} else {
|
241
|
+
return fn(context);
|
242
|
+
}
|
243
|
+
});
|
244
|
+
|
245
|
+
instance.registerHelper('each', function(context, options) {
|
246
|
+
var fn = options.fn, inverse = options.inverse;
|
247
|
+
var i = 0, ret = "", data;
|
248
|
+
|
249
|
+
if (isFunction(context)) { context = context.call(this); }
|
250
|
+
|
251
|
+
if (options.data) {
|
252
|
+
data = createFrame(options.data);
|
253
|
+
}
|
254
|
+
|
255
|
+
if(context && typeof context === 'object') {
|
256
|
+
if (isArray(context)) {
|
257
|
+
for(var j = context.length; i<j; i++) {
|
258
|
+
if (data) {
|
259
|
+
data.index = i;
|
260
|
+
data.first = (i === 0);
|
261
|
+
data.last = (i === (context.length-1));
|
262
|
+
}
|
263
|
+
ret = ret + fn(context[i], { data: data });
|
264
|
+
}
|
319
265
|
} else {
|
320
|
-
|
321
|
-
|
266
|
+
for(var key in context) {
|
267
|
+
if(context.hasOwnProperty(key)) {
|
268
|
+
if(data) {
|
269
|
+
data.key = key;
|
270
|
+
data.index = i;
|
271
|
+
data.first = (i === 0);
|
272
|
+
}
|
273
|
+
ret = ret + fn(context[key], {data: data});
|
274
|
+
i++;
|
322
275
|
}
|
323
|
-
|
276
|
+
}
|
324
277
|
}
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
278
|
+
}
|
279
|
+
|
280
|
+
if(i === 0){
|
281
|
+
ret = inverse(this);
|
282
|
+
}
|
283
|
+
|
284
|
+
return ret;
|
285
|
+
});
|
286
|
+
|
287
|
+
instance.registerHelper('if', function(conditional, options) {
|
288
|
+
if (isFunction(conditional)) { conditional = conditional.call(this); }
|
289
|
+
|
290
|
+
// Default behavior is to render the positive path if the value is truthy and not empty.
|
291
|
+
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
|
292
|
+
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
|
293
|
+
if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
|
294
|
+
return options.inverse(this);
|
295
|
+
} else {
|
296
|
+
return options.fn(this);
|
297
|
+
}
|
298
|
+
});
|
299
|
+
|
300
|
+
instance.registerHelper('unless', function(conditional, options) {
|
301
|
+
return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
|
302
|
+
});
|
303
|
+
|
304
|
+
instance.registerHelper('with', function(context, options) {
|
305
|
+
if (isFunction(context)) { context = context.call(this); }
|
306
|
+
|
307
|
+
if (!Utils.isEmpty(context)) return options.fn(context);
|
308
|
+
});
|
309
|
+
|
310
|
+
instance.registerHelper('log', function(context, options) {
|
311
|
+
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
|
312
|
+
instance.log(level, context);
|
313
|
+
});
|
314
|
+
}
|
315
|
+
|
316
|
+
var logger = {
|
317
|
+
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
|
318
|
+
|
319
|
+
// State enum
|
320
|
+
DEBUG: 0,
|
321
|
+
INFO: 1,
|
322
|
+
WARN: 2,
|
323
|
+
ERROR: 3,
|
324
|
+
level: 3,
|
325
|
+
|
326
|
+
// can be overridden in the host environment
|
327
|
+
log: function(level, obj) {
|
328
|
+
if (logger.level <= level) {
|
329
|
+
var method = logger.methodMap[level];
|
330
|
+
if (typeof console !== 'undefined' && console[method]) {
|
331
|
+
console[method].call(console, obj);
|
340
332
|
}
|
341
|
-
|
342
|
-
|
333
|
+
}
|
334
|
+
}
|
335
|
+
};
|
336
|
+
__exports__.logger = logger;
|
337
|
+
function log(level, obj) { logger.log(level, obj); }
|
338
|
+
|
339
|
+
__exports__.log = log;var createFrame = function(object) {
|
340
|
+
var obj = {};
|
341
|
+
Utils.extend(obj, object);
|
342
|
+
return obj;
|
343
|
+
};
|
344
|
+
__exports__.createFrame = createFrame;
|
345
|
+
return __exports__;
|
346
|
+
})(__module3__, __module5__);
|
347
|
+
|
348
|
+
// handlebars/runtime.js
|
349
|
+
var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
|
350
|
+
"use strict";
|
351
|
+
var __exports__ = {};
|
352
|
+
var Utils = __dependency1__;
|
353
|
+
var Exception = __dependency2__;
|
354
|
+
var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
|
355
|
+
var REVISION_CHANGES = __dependency3__.REVISION_CHANGES;
|
356
|
+
|
357
|
+
function checkRevision(compilerInfo) {
|
358
|
+
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
|
359
|
+
currentRevision = COMPILER_REVISION;
|
360
|
+
|
361
|
+
if (compilerRevision !== currentRevision) {
|
362
|
+
if (compilerRevision < currentRevision) {
|
363
|
+
var runtimeVersions = REVISION_CHANGES[currentRevision],
|
364
|
+
compilerVersions = REVISION_CHANGES[compilerRevision];
|
365
|
+
throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. "+
|
366
|
+
"Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").");
|
367
|
+
} else {
|
368
|
+
// Use the embedded version info since the runtime doesn't know about this revision yet
|
369
|
+
throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. "+
|
370
|
+
"Please update your runtime to a newer version ("+compilerInfo[1]+").");
|
371
|
+
}
|
372
|
+
}
|
373
|
+
}
|
374
|
+
|
375
|
+
__exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
|
376
|
+
|
377
|
+
function template(templateSpec, env) {
|
378
|
+
if (!env) {
|
379
|
+
throw new Exception("No environment passed to template");
|
380
|
+
}
|
381
|
+
|
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; }
|
387
|
+
|
388
|
+
if (env.compile) {
|
389
|
+
var options = { helpers: helpers, partials: partials, data: data };
|
390
|
+
partials[name] = env.compile(partial, { data: data !== undefined }, env);
|
391
|
+
return partials[name](context, options);
|
392
|
+
} else {
|
393
|
+
throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
|
394
|
+
}
|
395
|
+
};
|
396
|
+
|
397
|
+
// Just add water
|
398
|
+
var container = {
|
399
|
+
escapeExpression: Utils.escapeExpression,
|
400
|
+
invokePartial: invokePartialWrapper,
|
401
|
+
programs: [],
|
402
|
+
program: function(i, fn, data) {
|
403
|
+
var programWrapper = this.programs[i];
|
404
|
+
if(data) {
|
405
|
+
programWrapper = program(i, fn, data);
|
406
|
+
} else if (!programWrapper) {
|
407
|
+
programWrapper = this.programs[i] = program(i, fn);
|
343
408
|
}
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
yytext = this.lexer.yytext;
|
354
|
-
yylineno = this.lexer.yylineno;
|
355
|
-
yyloc = this.lexer.yylloc;
|
356
|
-
if (recovering > 0)
|
357
|
-
recovering--;
|
358
|
-
} else {
|
359
|
-
symbol = preErrorSymbol;
|
360
|
-
preErrorSymbol = null;
|
361
|
-
}
|
362
|
-
break;
|
363
|
-
case 2:
|
364
|
-
len = this.productions_[action[1]][1];
|
365
|
-
yyval.$ = vstack[vstack.length - len];
|
366
|
-
yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
|
367
|
-
if (ranges) {
|
368
|
-
yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
|
369
|
-
}
|
370
|
-
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
|
371
|
-
if (typeof r !== "undefined") {
|
372
|
-
return r;
|
373
|
-
}
|
374
|
-
if (len) {
|
375
|
-
stack = stack.slice(0, -1 * len * 2);
|
376
|
-
vstack = vstack.slice(0, -1 * len);
|
377
|
-
lstack = lstack.slice(0, -1 * len);
|
378
|
-
}
|
379
|
-
stack.push(this.productions_[action[1]][0]);
|
380
|
-
vstack.push(yyval.$);
|
381
|
-
lstack.push(yyval._$);
|
382
|
-
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
383
|
-
stack.push(newState);
|
384
|
-
break;
|
385
|
-
case 3:
|
386
|
-
return true;
|
409
|
+
return programWrapper;
|
410
|
+
},
|
411
|
+
merge: function(param, common) {
|
412
|
+
var ret = param || common;
|
413
|
+
|
414
|
+
if (param && common && (param !== common)) {
|
415
|
+
ret = {};
|
416
|
+
Utils.extend(ret, common);
|
417
|
+
Utils.extend(ret, param);
|
387
418
|
}
|
419
|
+
return ret;
|
420
|
+
},
|
421
|
+
programWithDepth: env.VM.programWithDepth,
|
422
|
+
noop: env.VM.noop,
|
423
|
+
compilerInfo: null
|
424
|
+
};
|
425
|
+
|
426
|
+
return function(context, options) {
|
427
|
+
options = options || {};
|
428
|
+
var namespace = options.partial ? options : env,
|
429
|
+
helpers,
|
430
|
+
partials;
|
431
|
+
|
432
|
+
if (!options.partial) {
|
433
|
+
helpers = options.helpers;
|
434
|
+
partials = options.partials;
|
435
|
+
}
|
436
|
+
var result = templateSpec.call(
|
437
|
+
container,
|
438
|
+
namespace, context,
|
439
|
+
helpers,
|
440
|
+
partials,
|
441
|
+
options.data);
|
442
|
+
|
443
|
+
if (!options.partial) {
|
444
|
+
env.VM.checkRevision(container.compilerInfo);
|
445
|
+
}
|
446
|
+
|
447
|
+
return result;
|
448
|
+
};
|
449
|
+
}
|
450
|
+
|
451
|
+
__exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) {
|
452
|
+
var args = Array.prototype.slice.call(arguments, 3);
|
453
|
+
|
454
|
+
var prog = function(context, options) {
|
455
|
+
options = options || {};
|
456
|
+
|
457
|
+
return fn.apply(this, [context, options.data || data].concat(args));
|
458
|
+
};
|
459
|
+
prog.program = i;
|
460
|
+
prog.depth = args.length;
|
461
|
+
return prog;
|
462
|
+
}
|
463
|
+
|
464
|
+
__exports__.programWithDepth = programWithDepth;function program(i, fn, data) {
|
465
|
+
var prog = function(context, options) {
|
466
|
+
options = options || {};
|
467
|
+
|
468
|
+
return fn(context, options.data || data);
|
469
|
+
};
|
470
|
+
prog.program = i;
|
471
|
+
prog.depth = 0;
|
472
|
+
return prog;
|
473
|
+
}
|
474
|
+
|
475
|
+
__exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) {
|
476
|
+
var options = { partial: true, helpers: helpers, partials: partials, data: data };
|
477
|
+
|
478
|
+
if(partial === undefined) {
|
479
|
+
throw new Exception("The partial " + name + " could not be found");
|
480
|
+
} else if(partial instanceof Function) {
|
481
|
+
return partial(context, options);
|
388
482
|
}
|
389
|
-
|
390
|
-
|
391
|
-
}
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
483
|
+
}
|
484
|
+
|
485
|
+
__exports__.invokePartial = invokePartial;function noop() { return ""; }
|
486
|
+
|
487
|
+
__exports__.noop = noop;
|
488
|
+
return __exports__;
|
489
|
+
})(__module3__, __module5__, __module2__);
|
490
|
+
|
491
|
+
// handlebars.runtime.js
|
492
|
+
var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
|
493
|
+
"use strict";
|
494
|
+
var __exports__;
|
495
|
+
/*globals Handlebars: true */
|
496
|
+
var base = __dependency1__;
|
497
|
+
|
498
|
+
// Each of these augment the Handlebars object. No need to setup here.
|
499
|
+
// (This is done to easily share code between commonjs and browse envs)
|
500
|
+
var SafeString = __dependency2__;
|
501
|
+
var Exception = __dependency3__;
|
502
|
+
var Utils = __dependency4__;
|
503
|
+
var runtime = __dependency5__;
|
504
|
+
|
505
|
+
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
|
506
|
+
var create = function() {
|
507
|
+
var hb = new base.HandlebarsEnvironment();
|
508
|
+
|
509
|
+
Utils.extend(hb, base);
|
510
|
+
hb.SafeString = SafeString;
|
511
|
+
hb.Exception = Exception;
|
512
|
+
hb.Utils = Utils;
|
513
|
+
|
514
|
+
hb.VM = runtime;
|
515
|
+
hb.template = function(spec) {
|
516
|
+
return runtime.template(spec, hb);
|
517
|
+
};
|
518
|
+
|
519
|
+
return hb;
|
520
|
+
};
|
521
|
+
|
522
|
+
var Handlebars = create();
|
523
|
+
Handlebars.create = create;
|
524
|
+
|
525
|
+
__exports__ = Handlebars;
|
526
|
+
return __exports__;
|
527
|
+
})(__module2__, __module4__, __module5__, __module3__, __module6__);
|
528
|
+
|
529
|
+
// handlebars/compiler/ast.js
|
530
|
+
var __module7__ = (function(__dependency1__) {
|
531
|
+
"use strict";
|
532
|
+
var __exports__;
|
533
|
+
var Exception = __dependency1__;
|
534
|
+
|
535
|
+
function LocationInfo(locInfo){
|
536
|
+
locInfo = locInfo || {};
|
537
|
+
this.firstLine = locInfo.first_line;
|
538
|
+
this.firstColumn = locInfo.first_column;
|
539
|
+
this.lastColumn = locInfo.last_column;
|
540
|
+
this.lastLine = locInfo.last_line;
|
541
|
+
}
|
542
|
+
|
543
|
+
var AST = {
|
544
|
+
ProgramNode: function(statements, inverseStrip, inverse, locInfo) {
|
545
|
+
var inverseLocationInfo, firstInverseNode;
|
546
|
+
if (arguments.length === 3) {
|
547
|
+
locInfo = inverse;
|
548
|
+
inverse = null;
|
549
|
+
} else if (arguments.length === 2) {
|
550
|
+
locInfo = inverseStrip;
|
551
|
+
inverseStrip = null;
|
552
|
+
}
|
553
|
+
|
554
|
+
LocationInfo.call(this, locInfo);
|
555
|
+
this.type = "program";
|
556
|
+
this.statements = statements;
|
557
|
+
this.strip = {};
|
558
|
+
|
559
|
+
if(inverse) {
|
560
|
+
firstInverseNode = inverse[0];
|
561
|
+
if (firstInverseNode) {
|
562
|
+
inverseLocationInfo = {
|
563
|
+
first_line: firstInverseNode.firstLine,
|
564
|
+
last_line: firstInverseNode.lastLine,
|
565
|
+
last_column: firstInverseNode.lastColumn,
|
566
|
+
first_column: firstInverseNode.firstColumn
|
567
|
+
};
|
568
|
+
this.inverse = new AST.ProgramNode(inverse, inverseStrip, inverseLocationInfo);
|
398
569
|
} else {
|
399
|
-
|
570
|
+
this.inverse = new AST.ProgramNode(inverse, inverseStrip);
|
400
571
|
}
|
572
|
+
this.strip.right = inverseStrip.left;
|
573
|
+
} else if (inverseStrip) {
|
574
|
+
this.strip.left = inverseStrip.right;
|
575
|
+
}
|
401
576
|
},
|
402
|
-
setInput:function (input) {
|
403
|
-
this._input = input;
|
404
|
-
this._more = this._less = this.done = false;
|
405
|
-
this.yylineno = this.yyleng = 0;
|
406
|
-
this.yytext = this.matched = this.match = '';
|
407
|
-
this.conditionStack = ['INITIAL'];
|
408
|
-
this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
|
409
|
-
if (this.options.ranges) this.yylloc.range = [0,0];
|
410
|
-
this.offset = 0;
|
411
|
-
return this;
|
412
|
-
},
|
413
|
-
input:function () {
|
414
|
-
var ch = this._input[0];
|
415
|
-
this.yytext += ch;
|
416
|
-
this.yyleng++;
|
417
|
-
this.offset++;
|
418
|
-
this.match += ch;
|
419
|
-
this.matched += ch;
|
420
|
-
var lines = ch.match(/(?:\r\n?|\n).*/g);
|
421
|
-
if (lines) {
|
422
|
-
this.yylineno++;
|
423
|
-
this.yylloc.last_line++;
|
424
|
-
} else {
|
425
|
-
this.yylloc.last_column++;
|
426
|
-
}
|
427
|
-
if (this.options.ranges) this.yylloc.range[1]++;
|
428
|
-
|
429
|
-
this._input = this._input.slice(1);
|
430
|
-
return ch;
|
431
|
-
},
|
432
|
-
unput:function (ch) {
|
433
|
-
var len = ch.length;
|
434
|
-
var lines = ch.split(/(?:\r\n?|\n)/g);
|
435
|
-
|
436
|
-
this._input = ch + this._input;
|
437
|
-
this.yytext = this.yytext.substr(0, this.yytext.length-len-1);
|
438
|
-
//this.yyleng -= len;
|
439
|
-
this.offset -= len;
|
440
|
-
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
441
|
-
this.match = this.match.substr(0, this.match.length-1);
|
442
|
-
this.matched = this.matched.substr(0, this.matched.length-1);
|
443
|
-
|
444
|
-
if (lines.length-1) this.yylineno -= lines.length-1;
|
445
|
-
var r = this.yylloc.range;
|
446
|
-
|
447
|
-
this.yylloc = {first_line: this.yylloc.first_line,
|
448
|
-
last_line: this.yylineno+1,
|
449
|
-
first_column: this.yylloc.first_column,
|
450
|
-
last_column: lines ?
|
451
|
-
(lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length:
|
452
|
-
this.yylloc.first_column - len
|
453
|
-
};
|
454
577
|
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
578
|
+
MustacheNode: function(rawParams, hash, open, strip, locInfo) {
|
579
|
+
LocationInfo.call(this, locInfo);
|
580
|
+
this.type = "mustache";
|
581
|
+
this.strip = strip;
|
582
|
+
|
583
|
+
// Open may be a string parsed from the parser or a passed boolean flag
|
584
|
+
if (open != null && open.charAt) {
|
585
|
+
// Must use charAt to support IE pre-10
|
586
|
+
var escapeFlag = open.charAt(3) || open.charAt(2);
|
587
|
+
this.escaped = escapeFlag !== '{' && escapeFlag !== '&';
|
588
|
+
} else {
|
589
|
+
this.escaped = !!open;
|
590
|
+
}
|
591
|
+
|
592
|
+
if (rawParams instanceof AST.SexprNode) {
|
593
|
+
this.sexpr = rawParams;
|
594
|
+
} else {
|
595
|
+
// Support old AST API
|
596
|
+
this.sexpr = new AST.SexprNode(rawParams, hash);
|
597
|
+
}
|
598
|
+
|
599
|
+
this.sexpr.isRoot = true;
|
600
|
+
|
601
|
+
// Support old AST API that stored this info in MustacheNode
|
602
|
+
this.id = this.sexpr.id;
|
603
|
+
this.params = this.sexpr.params;
|
604
|
+
this.hash = this.sexpr.hash;
|
605
|
+
this.eligibleHelper = this.sexpr.eligibleHelper;
|
606
|
+
this.isHelper = this.sexpr.isHelper;
|
482
607
|
},
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
if (!this.options.flex) break;
|
506
|
-
}
|
507
|
-
}
|
508
|
-
if (match) {
|
509
|
-
lines = match[0].match(/(?:\r\n?|\n).*/g);
|
510
|
-
if (lines) this.yylineno += lines.length;
|
511
|
-
this.yylloc = {first_line: this.yylloc.last_line,
|
512
|
-
last_line: this.yylineno+1,
|
513
|
-
first_column: this.yylloc.last_column,
|
514
|
-
last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length};
|
515
|
-
this.yytext += match[0];
|
516
|
-
this.match += match[0];
|
517
|
-
this.matches = match;
|
518
|
-
this.yyleng = this.yytext.length;
|
519
|
-
if (this.options.ranges) {
|
520
|
-
this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
521
|
-
}
|
522
|
-
this._more = false;
|
523
|
-
this._input = this._input.slice(match[0].length);
|
524
|
-
this.matched += match[0];
|
525
|
-
token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
|
526
|
-
if (this.done && this._input) this.done = false;
|
527
|
-
if (token) return token;
|
528
|
-
else return;
|
529
|
-
}
|
530
|
-
if (this._input === "") {
|
531
|
-
return this.EOF;
|
532
|
-
} else {
|
533
|
-
return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
|
534
|
-
{text: "", token: null, line: this.yylineno});
|
535
|
-
}
|
608
|
+
|
609
|
+
SexprNode: function(rawParams, hash, locInfo) {
|
610
|
+
LocationInfo.call(this, locInfo);
|
611
|
+
|
612
|
+
this.type = "sexpr";
|
613
|
+
this.hash = hash;
|
614
|
+
|
615
|
+
var id = this.id = rawParams[0];
|
616
|
+
var params = this.params = rawParams.slice(1);
|
617
|
+
|
618
|
+
// a mustache is an eligible helper if:
|
619
|
+
// * its id is simple (a single part, not `this` or `..`)
|
620
|
+
var eligibleHelper = this.eligibleHelper = id.isSimple;
|
621
|
+
|
622
|
+
// a mustache is definitely a helper if:
|
623
|
+
// * it is an eligible helper, and
|
624
|
+
// * it has at least one parameter or hash segment
|
625
|
+
this.isHelper = eligibleHelper && (params.length || hash);
|
626
|
+
|
627
|
+
// if a mustache is an eligible helper but not a definite
|
628
|
+
// helper, it is ambiguous, and will be resolved in a later
|
629
|
+
// pass or at runtime.
|
536
630
|
},
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
631
|
+
|
632
|
+
PartialNode: function(partialName, context, strip, locInfo) {
|
633
|
+
LocationInfo.call(this, locInfo);
|
634
|
+
this.type = "partial";
|
635
|
+
this.partialName = partialName;
|
636
|
+
this.context = context;
|
637
|
+
this.strip = strip;
|
544
638
|
},
|
545
|
-
begin:function begin(condition) {
|
546
|
-
this.conditionStack.push(condition);
|
547
|
-
},
|
548
|
-
popState:function popState() {
|
549
|
-
return this.conditionStack.pop();
|
550
|
-
},
|
551
|
-
_currentRules:function _currentRules() {
|
552
|
-
return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
|
553
|
-
},
|
554
|
-
topState:function () {
|
555
|
-
return this.conditionStack[this.conditionStack.length-2];
|
556
|
-
},
|
557
|
-
pushState:function begin(condition) {
|
558
|
-
this.begin(condition);
|
559
|
-
}});
|
560
|
-
lexer.options = {};
|
561
|
-
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
562
|
-
|
563
|
-
var YYSTATE=YY_START
|
564
|
-
switch($avoiding_name_collisions) {
|
565
|
-
case 0:
|
566
|
-
if(yy_.yytext.slice(-1) !== "\\") this.begin("mu");
|
567
|
-
if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin("emu");
|
568
|
-
if(yy_.yytext) return 14;
|
569
|
-
|
570
|
-
break;
|
571
|
-
case 1: return 14;
|
572
|
-
break;
|
573
|
-
case 2:
|
574
|
-
if(yy_.yytext.slice(-1) !== "\\") this.popState();
|
575
|
-
if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1);
|
576
|
-
return 14;
|
577
|
-
|
578
|
-
break;
|
579
|
-
case 3: yy_.yytext = yy_.yytext.substr(0, yy_.yyleng-4); this.popState(); return 15;
|
580
|
-
break;
|
581
|
-
case 4: this.begin("par"); return 24;
|
582
|
-
break;
|
583
|
-
case 5: return 16;
|
584
|
-
break;
|
585
|
-
case 6: return 20;
|
586
|
-
break;
|
587
|
-
case 7: return 19;
|
588
|
-
break;
|
589
|
-
case 8: return 19;
|
590
|
-
break;
|
591
|
-
case 9: return 23;
|
592
|
-
break;
|
593
|
-
case 10: return 23;
|
594
|
-
break;
|
595
|
-
case 11: this.popState(); this.begin('com');
|
596
|
-
break;
|
597
|
-
case 12: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15;
|
598
|
-
break;
|
599
|
-
case 13: return 22;
|
600
|
-
break;
|
601
|
-
case 14: return 36;
|
602
|
-
break;
|
603
|
-
case 15: return 35;
|
604
|
-
break;
|
605
|
-
case 16: return 35;
|
606
|
-
break;
|
607
|
-
case 17: return 39;
|
608
|
-
break;
|
609
|
-
case 18: /*ignore whitespace*/
|
610
|
-
break;
|
611
|
-
case 19: this.popState(); return 18;
|
612
|
-
break;
|
613
|
-
case 20: this.popState(); return 18;
|
614
|
-
break;
|
615
|
-
case 21: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 30;
|
616
|
-
break;
|
617
|
-
case 22: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\'/g,"'"); return 30;
|
618
|
-
break;
|
619
|
-
case 23: yy_.yytext = yy_.yytext.substr(1); return 28;
|
620
|
-
break;
|
621
|
-
case 24: return 32;
|
622
|
-
break;
|
623
|
-
case 25: return 32;
|
624
|
-
break;
|
625
|
-
case 26: return 31;
|
626
|
-
break;
|
627
|
-
case 27: return 35;
|
628
|
-
break;
|
629
|
-
case 28: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 35;
|
630
|
-
break;
|
631
|
-
case 29: return 'INVALID';
|
632
|
-
break;
|
633
|
-
case 30: /*ignore whitespace*/
|
634
|
-
break;
|
635
|
-
case 31: this.popState(); return 37;
|
636
|
-
break;
|
637
|
-
case 32: return 5;
|
638
|
-
break;
|
639
|
-
}
|
640
|
-
};
|
641
|
-
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_$-/]+)/,/^(?:$)/];
|
642
|
-
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}};
|
643
|
-
return lexer;})()
|
644
|
-
parser.lexer = lexer;
|
645
|
-
function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
|
646
|
-
return new Parser;
|
647
|
-
})();;
|
648
|
-
// lib/handlebars/compiler/base.js
|
649
|
-
Handlebars.Parser = handlebars;
|
650
|
-
|
651
|
-
Handlebars.parse = function(input) {
|
652
|
-
|
653
|
-
// Just return if an already-compile AST was passed in.
|
654
|
-
if(input.constructor === Handlebars.AST.ProgramNode) { return input; }
|
655
|
-
|
656
|
-
Handlebars.Parser.yy = Handlebars.AST;
|
657
|
-
return Handlebars.Parser.parse(input);
|
658
|
-
};
|
659
|
-
|
660
|
-
Handlebars.print = function(ast) {
|
661
|
-
return new Handlebars.PrintVisitor().accept(ast);
|
662
|
-
};;
|
663
|
-
// lib/handlebars/compiler/ast.js
|
664
|
-
(function() {
|
665
|
-
|
666
|
-
Handlebars.AST = {};
|
667
|
-
|
668
|
-
Handlebars.AST.ProgramNode = function(statements, inverse) {
|
669
|
-
this.type = "program";
|
670
|
-
this.statements = statements;
|
671
|
-
if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); }
|
672
|
-
};
|
673
639
|
|
674
|
-
|
675
|
-
|
676
|
-
this.escaped = !unescaped;
|
677
|
-
this.hash = hash;
|
640
|
+
BlockNode: function(mustache, program, inverse, close, locInfo) {
|
641
|
+
LocationInfo.call(this, locInfo);
|
678
642
|
|
679
|
-
|
680
|
-
|
643
|
+
if(mustache.sexpr.id.original !== close.path.original) {
|
644
|
+
throw new Exception(mustache.sexpr.id.original + " doesn't match " + close.path.original, this);
|
645
|
+
}
|
681
646
|
|
682
|
-
|
683
|
-
|
684
|
-
|
647
|
+
this.type = 'block';
|
648
|
+
this.mustache = mustache;
|
649
|
+
this.program = program;
|
650
|
+
this.inverse = inverse;
|
685
651
|
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
652
|
+
this.strip = {
|
653
|
+
left: mustache.strip.left,
|
654
|
+
right: close.strip.right
|
655
|
+
};
|
690
656
|
|
691
|
-
|
692
|
-
|
693
|
-
// pass or at runtime.
|
694
|
-
};
|
657
|
+
(program || inverse).strip.left = mustache.strip.right;
|
658
|
+
(inverse || program).strip.right = close.strip.left;
|
695
659
|
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
};
|
660
|
+
if (inverse && !program) {
|
661
|
+
this.isInverse = true;
|
662
|
+
}
|
663
|
+
},
|
701
664
|
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
665
|
+
ContentNode: function(string, locInfo) {
|
666
|
+
LocationInfo.call(this, locInfo);
|
667
|
+
this.type = "content";
|
668
|
+
this.string = string;
|
669
|
+
},
|
707
670
|
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
this.inverse = inverse;
|
671
|
+
HashNode: function(pairs, locInfo) {
|
672
|
+
LocationInfo.call(this, locInfo);
|
673
|
+
this.type = "hash";
|
674
|
+
this.pairs = pairs;
|
675
|
+
},
|
714
676
|
|
715
|
-
|
716
|
-
this
|
717
|
-
|
718
|
-
};
|
677
|
+
IdNode: function(parts, locInfo) {
|
678
|
+
LocationInfo.call(this, locInfo);
|
679
|
+
this.type = "ID";
|
719
680
|
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
};
|
681
|
+
var original = "",
|
682
|
+
dig = [],
|
683
|
+
depth = 0;
|
724
684
|
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
};
|
685
|
+
for(var i=0,l=parts.length; i<l; i++) {
|
686
|
+
var part = parts[i].part;
|
687
|
+
original += (parts[i].separator || '') + part;
|
729
688
|
|
730
|
-
|
731
|
-
|
732
|
-
|
689
|
+
if (part === ".." || part === "." || part === "this") {
|
690
|
+
if (dig.length > 0) {
|
691
|
+
throw new Exception("Invalid path: " + original, this);
|
692
|
+
} else if (part === "..") {
|
693
|
+
depth++;
|
694
|
+
} else {
|
695
|
+
this.isScoped = true;
|
696
|
+
}
|
697
|
+
} else {
|
698
|
+
dig.push(part);
|
699
|
+
}
|
700
|
+
}
|
733
701
|
|
734
|
-
|
702
|
+
this.original = original;
|
703
|
+
this.parts = dig;
|
704
|
+
this.string = dig.join('.');
|
705
|
+
this.depth = depth;
|
735
706
|
|
736
|
-
|
737
|
-
|
707
|
+
// an ID is simple if it only has one part, and that part is not
|
708
|
+
// `..` or `this`.
|
709
|
+
this.isSimple = parts.length === 1 && !this.isScoped && depth === 0;
|
738
710
|
|
739
|
-
|
740
|
-
|
741
|
-
else if (part === "..") { depth++; }
|
742
|
-
else { this.isScoped = true; }
|
743
|
-
}
|
744
|
-
else { dig.push(part); }
|
745
|
-
}
|
711
|
+
this.stringModeValue = this.string;
|
712
|
+
},
|
746
713
|
|
747
|
-
|
748
|
-
|
749
|
-
|
714
|
+
PartialNameNode: function(name, locInfo) {
|
715
|
+
LocationInfo.call(this, locInfo);
|
716
|
+
this.type = "PARTIAL_NAME";
|
717
|
+
this.name = name.original;
|
718
|
+
},
|
750
719
|
|
751
|
-
|
752
|
-
|
753
|
-
|
720
|
+
DataNode: function(id, locInfo) {
|
721
|
+
LocationInfo.call(this, locInfo);
|
722
|
+
this.type = "DATA";
|
723
|
+
this.id = id;
|
724
|
+
},
|
754
725
|
|
755
|
-
|
756
|
-
|
726
|
+
StringNode: function(string, locInfo) {
|
727
|
+
LocationInfo.call(this, locInfo);
|
728
|
+
this.type = "STRING";
|
729
|
+
this.original =
|
730
|
+
this.string =
|
731
|
+
this.stringModeValue = string;
|
732
|
+
},
|
757
733
|
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
734
|
+
IntegerNode: function(integer, locInfo) {
|
735
|
+
LocationInfo.call(this, locInfo);
|
736
|
+
this.type = "INTEGER";
|
737
|
+
this.original =
|
738
|
+
this.integer = integer;
|
739
|
+
this.stringModeValue = Number(integer);
|
740
|
+
},
|
762
741
|
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
742
|
+
BooleanNode: function(bool, locInfo) {
|
743
|
+
LocationInfo.call(this, locInfo);
|
744
|
+
this.type = "BOOLEAN";
|
745
|
+
this.bool = bool;
|
746
|
+
this.stringModeValue = bool === "true";
|
747
|
+
},
|
767
748
|
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
749
|
+
CommentNode: function(comment, locInfo) {
|
750
|
+
LocationInfo.call(this, locInfo);
|
751
|
+
this.type = "comment";
|
752
|
+
this.comment = comment;
|
753
|
+
}
|
772
754
|
};
|
773
755
|
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
756
|
+
// Must be exported as an object rather than the root of the module as the jison lexer
|
757
|
+
// most modify the object to operate properly.
|
758
|
+
__exports__ = AST;
|
759
|
+
return __exports__;
|
760
|
+
})(__module5__);
|
761
|
+
|
762
|
+
// handlebars/compiler/parser.js
|
763
|
+
var __module9__ = (function() {
|
764
|
+
"use strict";
|
765
|
+
var __exports__;
|
766
|
+
/* jshint ignore:start */
|
767
|
+
/* Jison generated parser */
|
768
|
+
var handlebars = (function(){
|
769
|
+
var parser = {trace: function trace() { },
|
770
|
+
yy: {},
|
771
|
+
symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"sexpr":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"sexpr_repetition0":28,"sexpr_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"OPEN_SEXPR":35,"CLOSE_SEXPR":36,"hash":37,"hash_repetition_plus0":38,"hashSegment":39,"ID":40,"EQUALS":41,"DATA":42,"pathSegments":43,"SEP":44,"$accept":0,"$end":1},
|
772
|
+
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:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"},
|
773
|
+
productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]],
|
774
|
+
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
|
775
|
+
|
776
|
+
var $0 = $$.length - 1;
|
777
|
+
switch (yystate) {
|
778
|
+
case 1: return new yy.ProgramNode($$[$0-1], this._$);
|
779
|
+
break;
|
780
|
+
case 2: return new yy.ProgramNode([], this._$);
|
781
|
+
break;
|
782
|
+
case 3:this.$ = new yy.ProgramNode([], $$[$0-1], $$[$0], this._$);
|
783
|
+
break;
|
784
|
+
case 4:this.$ = new yy.ProgramNode($$[$0-2], $$[$0-1], $$[$0], this._$);
|
785
|
+
break;
|
786
|
+
case 5:this.$ = new yy.ProgramNode($$[$0-1], $$[$0], [], this._$);
|
787
|
+
break;
|
788
|
+
case 6:this.$ = new yy.ProgramNode($$[$0], this._$);
|
789
|
+
break;
|
790
|
+
case 7:this.$ = new yy.ProgramNode([], this._$);
|
791
|
+
break;
|
792
|
+
case 8:this.$ = new yy.ProgramNode([], this._$);
|
793
|
+
break;
|
794
|
+
case 9:this.$ = [$$[$0]];
|
795
|
+
break;
|
796
|
+
case 10: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
|
797
|
+
break;
|
798
|
+
case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$);
|
799
|
+
break;
|
800
|
+
case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$);
|
801
|
+
break;
|
802
|
+
case 13:this.$ = $$[$0];
|
803
|
+
break;
|
804
|
+
case 14:this.$ = $$[$0];
|
805
|
+
break;
|
806
|
+
case 15:this.$ = new yy.ContentNode($$[$0], this._$);
|
807
|
+
break;
|
808
|
+
case 16:this.$ = new yy.CommentNode($$[$0], this._$);
|
809
|
+
break;
|
810
|
+
case 17:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$);
|
811
|
+
break;
|
812
|
+
case 18:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$);
|
813
|
+
break;
|
814
|
+
case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])};
|
815
|
+
break;
|
816
|
+
case 20:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$);
|
817
|
+
break;
|
818
|
+
case 21:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$);
|
819
|
+
break;
|
820
|
+
case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$);
|
821
|
+
break;
|
822
|
+
case 23:this.$ = stripFlags($$[$0-1], $$[$0]);
|
823
|
+
break;
|
824
|
+
case 24:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$);
|
825
|
+
break;
|
826
|
+
case 25:this.$ = new yy.SexprNode([$$[$0]], null, this._$);
|
827
|
+
break;
|
828
|
+
case 26:this.$ = $$[$0];
|
829
|
+
break;
|
830
|
+
case 27:this.$ = new yy.StringNode($$[$0], this._$);
|
831
|
+
break;
|
832
|
+
case 28:this.$ = new yy.IntegerNode($$[$0], this._$);
|
833
|
+
break;
|
834
|
+
case 29:this.$ = new yy.BooleanNode($$[$0], this._$);
|
835
|
+
break;
|
836
|
+
case 30:this.$ = $$[$0];
|
837
|
+
break;
|
838
|
+
case 31:$$[$0-1].isHelper = true; this.$ = $$[$0-1];
|
839
|
+
break;
|
840
|
+
case 32:this.$ = new yy.HashNode($$[$0], this._$);
|
841
|
+
break;
|
842
|
+
case 33:this.$ = [$$[$0-2], $$[$0]];
|
843
|
+
break;
|
844
|
+
case 34:this.$ = new yy.PartialNameNode($$[$0], this._$);
|
845
|
+
break;
|
846
|
+
case 35:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$);
|
847
|
+
break;
|
848
|
+
case 36:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0], this._$));
|
849
|
+
break;
|
850
|
+
case 37:this.$ = new yy.DataNode($$[$0], this._$);
|
851
|
+
break;
|
852
|
+
case 38:this.$ = new yy.IdNode($$[$0], this._$);
|
853
|
+
break;
|
854
|
+
case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2];
|
855
|
+
break;
|
856
|
+
case 40:this.$ = [{part: $$[$0]}];
|
857
|
+
break;
|
858
|
+
case 43:this.$ = [];
|
859
|
+
break;
|
860
|
+
case 44:$$[$0-1].push($$[$0]);
|
861
|
+
break;
|
862
|
+
case 47:this.$ = [$$[$0]];
|
863
|
+
break;
|
864
|
+
case 48:$$[$0-1].push($$[$0]);
|
865
|
+
break;
|
866
|
+
}
|
867
|
+
},
|
868
|
+
table: [{3:1,4:2,5:[1,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],25:[1,15]},{1:[3]},{5:[1,16],8:17,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],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[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],25:[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],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[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],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,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],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}],
|
869
|
+
defaultActions: {3:[2,2],16:[2,1],50:[2,42]},
|
870
|
+
parseError: function parseError(str, hash) {
|
871
|
+
throw new Error(str);
|
872
|
+
},
|
873
|
+
parse: function parse(input) {
|
874
|
+
var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
875
|
+
this.lexer.setInput(input);
|
876
|
+
this.lexer.yy = this.yy;
|
877
|
+
this.yy.lexer = this.lexer;
|
878
|
+
this.yy.parser = this;
|
879
|
+
if (typeof this.lexer.yylloc == "undefined")
|
880
|
+
this.lexer.yylloc = {};
|
881
|
+
var yyloc = this.lexer.yylloc;
|
882
|
+
lstack.push(yyloc);
|
883
|
+
var ranges = this.lexer.options && this.lexer.options.ranges;
|
884
|
+
if (typeof this.yy.parseError === "function")
|
885
|
+
this.parseError = this.yy.parseError;
|
886
|
+
function popStack(n) {
|
887
|
+
stack.length = stack.length - 2 * n;
|
888
|
+
vstack.length = vstack.length - n;
|
889
|
+
lstack.length = lstack.length - n;
|
890
|
+
}
|
891
|
+
function lex() {
|
892
|
+
var token;
|
893
|
+
token = self.lexer.lex() || 1;
|
894
|
+
if (typeof token !== "number") {
|
895
|
+
token = self.symbols_[token] || token;
|
896
|
+
}
|
897
|
+
return token;
|
898
|
+
}
|
899
|
+
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
900
|
+
while (true) {
|
901
|
+
state = stack[stack.length - 1];
|
902
|
+
if (this.defaultActions[state]) {
|
903
|
+
action = this.defaultActions[state];
|
904
|
+
} else {
|
905
|
+
if (symbol === null || typeof symbol == "undefined") {
|
906
|
+
symbol = lex();
|
907
|
+
}
|
908
|
+
action = table[state] && table[state][symbol];
|
909
|
+
}
|
910
|
+
if (typeof action === "undefined" || !action.length || !action[0]) {
|
911
|
+
var errStr = "";
|
912
|
+
if (!recovering) {
|
913
|
+
expected = [];
|
914
|
+
for (p in table[state])
|
915
|
+
if (this.terminals_[p] && p > 2) {
|
916
|
+
expected.push("'" + this.terminals_[p] + "'");
|
917
|
+
}
|
918
|
+
if (this.lexer.showPosition) {
|
919
|
+
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
920
|
+
} else {
|
921
|
+
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
|
922
|
+
}
|
923
|
+
this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
|
924
|
+
}
|
925
|
+
}
|
926
|
+
if (action[0] instanceof Array && action.length > 1) {
|
927
|
+
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
928
|
+
}
|
929
|
+
switch (action[0]) {
|
930
|
+
case 1:
|
931
|
+
stack.push(symbol);
|
932
|
+
vstack.push(this.lexer.yytext);
|
933
|
+
lstack.push(this.lexer.yylloc);
|
934
|
+
stack.push(action[1]);
|
935
|
+
symbol = null;
|
936
|
+
if (!preErrorSymbol) {
|
937
|
+
yyleng = this.lexer.yyleng;
|
938
|
+
yytext = this.lexer.yytext;
|
939
|
+
yylineno = this.lexer.yylineno;
|
940
|
+
yyloc = this.lexer.yylloc;
|
941
|
+
if (recovering > 0)
|
942
|
+
recovering--;
|
943
|
+
} else {
|
944
|
+
symbol = preErrorSymbol;
|
945
|
+
preErrorSymbol = null;
|
946
|
+
}
|
947
|
+
break;
|
948
|
+
case 2:
|
949
|
+
len = this.productions_[action[1]][1];
|
950
|
+
yyval.$ = vstack[vstack.length - len];
|
951
|
+
yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
|
952
|
+
if (ranges) {
|
953
|
+
yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
|
954
|
+
}
|
955
|
+
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
|
956
|
+
if (typeof r !== "undefined") {
|
957
|
+
return r;
|
958
|
+
}
|
959
|
+
if (len) {
|
960
|
+
stack = stack.slice(0, -1 * len * 2);
|
961
|
+
vstack = vstack.slice(0, -1 * len);
|
962
|
+
lstack = lstack.slice(0, -1 * len);
|
963
|
+
}
|
964
|
+
stack.push(this.productions_[action[1]][0]);
|
965
|
+
vstack.push(yyval.$);
|
966
|
+
lstack.push(yyval._$);
|
967
|
+
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
968
|
+
stack.push(newState);
|
969
|
+
break;
|
970
|
+
case 3:
|
971
|
+
return true;
|
972
|
+
}
|
973
|
+
}
|
974
|
+
return true;
|
975
|
+
}
|
778
976
|
};
|
779
977
|
|
780
|
-
Handlebars.AST.BooleanNode = function(bool) {
|
781
|
-
this.type = "BOOLEAN";
|
782
|
-
this.bool = bool;
|
783
|
-
this.stringModeValue = bool === "true";
|
784
|
-
};
|
785
978
|
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
979
|
+
function stripFlags(open, close) {
|
980
|
+
return {
|
981
|
+
left: open.charAt(2) === '~',
|
982
|
+
right: close.charAt(0) === '~' || close.charAt(1) === '~'
|
983
|
+
};
|
984
|
+
}
|
790
985
|
|
791
|
-
|
792
|
-
|
986
|
+
/* Jison generated lexer */
|
987
|
+
var lexer = (function(){
|
988
|
+
var lexer = ({EOF:1,
|
989
|
+
parseError:function parseError(str, hash) {
|
990
|
+
if (this.yy.parser) {
|
991
|
+
this.yy.parser.parseError(str, hash);
|
992
|
+
} else {
|
993
|
+
throw new Error(str);
|
994
|
+
}
|
995
|
+
},
|
996
|
+
setInput:function (input) {
|
997
|
+
this._input = input;
|
998
|
+
this._more = this._less = this.done = false;
|
999
|
+
this.yylineno = this.yyleng = 0;
|
1000
|
+
this.yytext = this.matched = this.match = '';
|
1001
|
+
this.conditionStack = ['INITIAL'];
|
1002
|
+
this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
|
1003
|
+
if (this.options.ranges) this.yylloc.range = [0,0];
|
1004
|
+
this.offset = 0;
|
1005
|
+
return this;
|
1006
|
+
},
|
1007
|
+
input:function () {
|
1008
|
+
var ch = this._input[0];
|
1009
|
+
this.yytext += ch;
|
1010
|
+
this.yyleng++;
|
1011
|
+
this.offset++;
|
1012
|
+
this.match += ch;
|
1013
|
+
this.matched += ch;
|
1014
|
+
var lines = ch.match(/(?:\r\n?|\n).*/g);
|
1015
|
+
if (lines) {
|
1016
|
+
this.yylineno++;
|
1017
|
+
this.yylloc.last_line++;
|
1018
|
+
} else {
|
1019
|
+
this.yylloc.last_column++;
|
1020
|
+
}
|
1021
|
+
if (this.options.ranges) this.yylloc.range[1]++;
|
793
1022
|
|
794
|
-
|
1023
|
+
this._input = this._input.slice(1);
|
1024
|
+
return ch;
|
1025
|
+
},
|
1026
|
+
unput:function (ch) {
|
1027
|
+
var len = ch.length;
|
1028
|
+
var lines = ch.split(/(?:\r\n?|\n)/g);
|
1029
|
+
|
1030
|
+
this._input = ch + this._input;
|
1031
|
+
this.yytext = this.yytext.substr(0, this.yytext.length-len-1);
|
1032
|
+
//this.yyleng -= len;
|
1033
|
+
this.offset -= len;
|
1034
|
+
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
1035
|
+
this.match = this.match.substr(0, this.match.length-1);
|
1036
|
+
this.matched = this.matched.substr(0, this.matched.length-1);
|
1037
|
+
|
1038
|
+
if (lines.length-1) this.yylineno -= lines.length-1;
|
1039
|
+
var r = this.yylloc.range;
|
1040
|
+
|
1041
|
+
this.yylloc = {first_line: this.yylloc.first_line,
|
1042
|
+
last_line: this.yylineno+1,
|
1043
|
+
first_column: this.yylloc.first_column,
|
1044
|
+
last_column: lines ?
|
1045
|
+
(lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length:
|
1046
|
+
this.yylloc.first_column - len
|
1047
|
+
};
|
1048
|
+
|
1049
|
+
if (this.options.ranges) {
|
1050
|
+
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
1051
|
+
}
|
1052
|
+
return this;
|
1053
|
+
},
|
1054
|
+
more:function () {
|
1055
|
+
this._more = true;
|
1056
|
+
return this;
|
1057
|
+
},
|
1058
|
+
less:function (n) {
|
1059
|
+
this.unput(this.match.slice(n));
|
1060
|
+
},
|
1061
|
+
pastInput:function () {
|
1062
|
+
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
1063
|
+
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
1064
|
+
},
|
1065
|
+
upcomingInput:function () {
|
1066
|
+
var next = this.match;
|
1067
|
+
if (next.length < 20) {
|
1068
|
+
next += this._input.substr(0, 20-next.length);
|
1069
|
+
}
|
1070
|
+
return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
|
1071
|
+
},
|
1072
|
+
showPosition:function () {
|
1073
|
+
var pre = this.pastInput();
|
1074
|
+
var c = new Array(pre.length + 1).join("-");
|
1075
|
+
return pre + this.upcomingInput() + "\n" + c+"^";
|
1076
|
+
},
|
1077
|
+
next:function () {
|
1078
|
+
if (this.done) {
|
1079
|
+
return this.EOF;
|
1080
|
+
}
|
1081
|
+
if (!this._input) this.done = true;
|
1082
|
+
|
1083
|
+
var token,
|
1084
|
+
match,
|
1085
|
+
tempMatch,
|
1086
|
+
index,
|
1087
|
+
col,
|
1088
|
+
lines;
|
1089
|
+
if (!this._more) {
|
1090
|
+
this.yytext = '';
|
1091
|
+
this.match = '';
|
1092
|
+
}
|
1093
|
+
var rules = this._currentRules();
|
1094
|
+
for (var i=0;i < rules.length; i++) {
|
1095
|
+
tempMatch = this._input.match(this.rules[rules[i]]);
|
1096
|
+
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
1097
|
+
match = tempMatch;
|
1098
|
+
index = i;
|
1099
|
+
if (!this.options.flex) break;
|
1100
|
+
}
|
1101
|
+
}
|
1102
|
+
if (match) {
|
1103
|
+
lines = match[0].match(/(?:\r\n?|\n).*/g);
|
1104
|
+
if (lines) this.yylineno += lines.length;
|
1105
|
+
this.yylloc = {first_line: this.yylloc.last_line,
|
1106
|
+
last_line: this.yylineno+1,
|
1107
|
+
first_column: this.yylloc.last_column,
|
1108
|
+
last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length};
|
1109
|
+
this.yytext += match[0];
|
1110
|
+
this.match += match[0];
|
1111
|
+
this.matches = match;
|
1112
|
+
this.yyleng = this.yytext.length;
|
1113
|
+
if (this.options.ranges) {
|
1114
|
+
this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
1115
|
+
}
|
1116
|
+
this._more = false;
|
1117
|
+
this._input = this._input.slice(match[0].length);
|
1118
|
+
this.matched += match[0];
|
1119
|
+
token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
|
1120
|
+
if (this.done && this._input) this.done = false;
|
1121
|
+
if (token) return token;
|
1122
|
+
else return;
|
1123
|
+
}
|
1124
|
+
if (this._input === "") {
|
1125
|
+
return this.EOF;
|
1126
|
+
} else {
|
1127
|
+
return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
|
1128
|
+
{text: "", token: null, line: this.yylineno});
|
1129
|
+
}
|
1130
|
+
},
|
1131
|
+
lex:function lex() {
|
1132
|
+
var r = this.next();
|
1133
|
+
if (typeof r !== 'undefined') {
|
1134
|
+
return r;
|
1135
|
+
} else {
|
1136
|
+
return this.lex();
|
1137
|
+
}
|
1138
|
+
},
|
1139
|
+
begin:function begin(condition) {
|
1140
|
+
this.conditionStack.push(condition);
|
1141
|
+
},
|
1142
|
+
popState:function popState() {
|
1143
|
+
return this.conditionStack.pop();
|
1144
|
+
},
|
1145
|
+
_currentRules:function _currentRules() {
|
1146
|
+
return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
|
1147
|
+
},
|
1148
|
+
topState:function () {
|
1149
|
+
return this.conditionStack[this.conditionStack.length-2];
|
1150
|
+
},
|
1151
|
+
pushState:function begin(condition) {
|
1152
|
+
this.begin(condition);
|
1153
|
+
}});
|
1154
|
+
lexer.options = {};
|
1155
|
+
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
795
1156
|
|
796
|
-
Handlebars.Exception = function(message) {
|
797
|
-
var tmp = Error.prototype.constructor.apply(this, arguments);
|
798
1157
|
|
799
|
-
|
800
|
-
|
801
|
-
this[errorProps[idx]] = tmp[errorProps[idx]];
|
1158
|
+
function strip(start, end) {
|
1159
|
+
return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end);
|
802
1160
|
}
|
803
|
-
};
|
804
|
-
Handlebars.Exception.prototype = new Error();
|
805
|
-
|
806
|
-
// Build out our basic SafeString type
|
807
|
-
Handlebars.SafeString = function(string) {
|
808
|
-
this.string = string;
|
809
|
-
};
|
810
|
-
Handlebars.SafeString.prototype.toString = function() {
|
811
|
-
return this.string.toString();
|
812
|
-
};
|
813
|
-
|
814
|
-
(function() {
|
815
|
-
var escape = {
|
816
|
-
"&": "&",
|
817
|
-
"<": "<",
|
818
|
-
">": ">",
|
819
|
-
'"': """,
|
820
|
-
"'": "'",
|
821
|
-
"`": "`"
|
822
|
-
};
|
823
1161
|
|
824
|
-
var badChars = /[&<>"'`]/g;
|
825
|
-
var possible = /[&<>"'`]/;
|
826
1162
|
|
827
|
-
var
|
828
|
-
|
1163
|
+
var YYSTATE=YY_START
|
1164
|
+
switch($avoiding_name_collisions) {
|
1165
|
+
case 0:
|
1166
|
+
if(yy_.yytext.slice(-2) === "\\\\") {
|
1167
|
+
strip(0,1);
|
1168
|
+
this.begin("mu");
|
1169
|
+
} else if(yy_.yytext.slice(-1) === "\\") {
|
1170
|
+
strip(0,1);
|
1171
|
+
this.begin("emu");
|
1172
|
+
} else {
|
1173
|
+
this.begin("mu");
|
1174
|
+
}
|
1175
|
+
if(yy_.yytext) return 14;
|
1176
|
+
|
1177
|
+
break;
|
1178
|
+
case 1:return 14;
|
1179
|
+
break;
|
1180
|
+
case 2:
|
1181
|
+
this.popState();
|
1182
|
+
return 14;
|
1183
|
+
|
1184
|
+
break;
|
1185
|
+
case 3:strip(0,4); this.popState(); return 15;
|
1186
|
+
break;
|
1187
|
+
case 4:return 35;
|
1188
|
+
break;
|
1189
|
+
case 5:return 36;
|
1190
|
+
break;
|
1191
|
+
case 6:return 25;
|
1192
|
+
break;
|
1193
|
+
case 7:return 16;
|
1194
|
+
break;
|
1195
|
+
case 8:return 20;
|
1196
|
+
break;
|
1197
|
+
case 9:return 19;
|
1198
|
+
break;
|
1199
|
+
case 10:return 19;
|
1200
|
+
break;
|
1201
|
+
case 11:return 23;
|
1202
|
+
break;
|
1203
|
+
case 12:return 22;
|
1204
|
+
break;
|
1205
|
+
case 13:this.popState(); this.begin('com');
|
1206
|
+
break;
|
1207
|
+
case 14:strip(3,5); this.popState(); return 15;
|
1208
|
+
break;
|
1209
|
+
case 15:return 22;
|
1210
|
+
break;
|
1211
|
+
case 16:return 41;
|
1212
|
+
break;
|
1213
|
+
case 17:return 40;
|
1214
|
+
break;
|
1215
|
+
case 18:return 40;
|
1216
|
+
break;
|
1217
|
+
case 19:return 44;
|
1218
|
+
break;
|
1219
|
+
case 20:// ignore whitespace
|
1220
|
+
break;
|
1221
|
+
case 21:this.popState(); return 24;
|
1222
|
+
break;
|
1223
|
+
case 22:this.popState(); return 18;
|
1224
|
+
break;
|
1225
|
+
case 23:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32;
|
1226
|
+
break;
|
1227
|
+
case 24:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32;
|
1228
|
+
break;
|
1229
|
+
case 25:return 42;
|
1230
|
+
break;
|
1231
|
+
case 26:return 34;
|
1232
|
+
break;
|
1233
|
+
case 27:return 34;
|
1234
|
+
break;
|
1235
|
+
case 28:return 33;
|
1236
|
+
break;
|
1237
|
+
case 29:return 40;
|
1238
|
+
break;
|
1239
|
+
case 30:yy_.yytext = strip(1,2); return 40;
|
1240
|
+
break;
|
1241
|
+
case 31:return 'INVALID';
|
1242
|
+
break;
|
1243
|
+
case 32:return 5;
|
1244
|
+
break;
|
1245
|
+
}
|
829
1246
|
};
|
1247
|
+
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
|
1248
|
+
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,31,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}};
|
1249
|
+
return lexer;})()
|
1250
|
+
parser.lexer = lexer;
|
1251
|
+
function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
|
1252
|
+
return new Parser;
|
1253
|
+
})();__exports__ = handlebars;
|
1254
|
+
/* jshint ignore:end */
|
1255
|
+
return __exports__;
|
1256
|
+
})();
|
1257
|
+
|
1258
|
+
// handlebars/compiler/base.js
|
1259
|
+
var __module8__ = (function(__dependency1__, __dependency2__) {
|
1260
|
+
"use strict";
|
1261
|
+
var __exports__ = {};
|
1262
|
+
var parser = __dependency1__;
|
1263
|
+
var AST = __dependency2__;
|
1264
|
+
|
1265
|
+
__exports__.parser = parser;
|
1266
|
+
|
1267
|
+
function parse(input) {
|
1268
|
+
// Just return if an already-compile AST was passed in.
|
1269
|
+
if(input.constructor === AST.ProgramNode) { return input; }
|
1270
|
+
|
1271
|
+
parser.yy = AST;
|
1272
|
+
return parser.parse(input);
|
1273
|
+
}
|
830
1274
|
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
if (string instanceof Handlebars.SafeString) {
|
835
|
-
return string.toString();
|
836
|
-
} else if (string == null || string === false) {
|
837
|
-
return "";
|
838
|
-
}
|
839
|
-
|
840
|
-
if(!possible.test(string)) { return string; }
|
841
|
-
return string.replace(badChars, escapeChar);
|
842
|
-
},
|
1275
|
+
__exports__.parse = parse;
|
1276
|
+
return __exports__;
|
1277
|
+
})(__module9__, __module7__);
|
843
1278
|
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
} else {
|
850
|
-
return false;
|
851
|
-
}
|
852
|
-
}
|
853
|
-
};
|
854
|
-
})();;
|
855
|
-
// lib/handlebars/compiler/compiler.js
|
1279
|
+
// handlebars/compiler/compiler.js
|
1280
|
+
var __module10__ = (function(__dependency1__) {
|
1281
|
+
"use strict";
|
1282
|
+
var __exports__ = {};
|
1283
|
+
var Exception = __dependency1__;
|
856
1284
|
|
857
|
-
|
858
|
-
Handlebars.Compiler = function() {};
|
859
|
-
Handlebars.JavaScriptCompiler = function() {};
|
1285
|
+
function Compiler() {}
|
860
1286
|
|
861
|
-
|
862
|
-
// the foundHelper register will disambiguate helper lookup from finding a
|
1287
|
+
__exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a
|
863
1288
|
// function in a context. This is necessary for mustache compatibility, which
|
864
1289
|
// requires that context functions in blocks are evaluated by blockHelperMissing,
|
865
1290
|
// and then proceed as if the resulting value was provided to blockHelperMissing.
|
@@ -890,6 +1315,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
890
1315
|
|
891
1316
|
return out.join("\n");
|
892
1317
|
},
|
1318
|
+
|
893
1319
|
equals: function(other) {
|
894
1320
|
var len = this.opcodes.length;
|
895
1321
|
if (other.opcodes.length !== len) {
|
@@ -908,12 +1334,24 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
908
1334
|
}
|
909
1335
|
}
|
910
1336
|
}
|
1337
|
+
|
1338
|
+
len = this.children.length;
|
1339
|
+
if (other.children.length !== len) {
|
1340
|
+
return false;
|
1341
|
+
}
|
1342
|
+
for (i = 0; i < len; i++) {
|
1343
|
+
if (!this.children[i].equals(other.children[i])) {
|
1344
|
+
return false;
|
1345
|
+
}
|
1346
|
+
}
|
1347
|
+
|
911
1348
|
return true;
|
912
1349
|
},
|
913
1350
|
|
914
1351
|
guid: 0,
|
915
1352
|
|
916
1353
|
compile: function(program, options) {
|
1354
|
+
this.opcodes = [];
|
917
1355
|
this.children = [];
|
918
1356
|
this.depths = {list: []};
|
919
1357
|
this.options = options;
|
@@ -935,20 +1373,30 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
935
1373
|
}
|
936
1374
|
}
|
937
1375
|
|
938
|
-
return this.
|
1376
|
+
return this.accept(program);
|
939
1377
|
},
|
940
1378
|
|
941
1379
|
accept: function(node) {
|
942
|
-
|
1380
|
+
var strip = node.strip || {},
|
1381
|
+
ret;
|
1382
|
+
if (strip.left) {
|
1383
|
+
this.opcode('strip');
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
ret = this[node.type](node);
|
1387
|
+
|
1388
|
+
if (strip.right) {
|
1389
|
+
this.opcode('strip');
|
1390
|
+
}
|
1391
|
+
|
1392
|
+
return ret;
|
943
1393
|
},
|
944
1394
|
|
945
1395
|
program: function(program) {
|
946
|
-
var statements = program.statements
|
947
|
-
this.opcodes = [];
|
1396
|
+
var statements = program.statements;
|
948
1397
|
|
949
1398
|
for(var i=0, l=statements.length; i<l; i++) {
|
950
|
-
|
951
|
-
this[statement.type](statement);
|
1399
|
+
this.accept(statements[i]);
|
952
1400
|
}
|
953
1401
|
this.isSimple = l === 1;
|
954
1402
|
|
@@ -990,12 +1438,13 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
990
1438
|
inverse = this.compileProgram(inverse);
|
991
1439
|
}
|
992
1440
|
|
993
|
-
var
|
1441
|
+
var sexpr = mustache.sexpr;
|
1442
|
+
var type = this.classifySexpr(sexpr);
|
994
1443
|
|
995
1444
|
if (type === "helper") {
|
996
|
-
this.
|
1445
|
+
this.helperSexpr(sexpr, program, inverse);
|
997
1446
|
} else if (type === "simple") {
|
998
|
-
this.
|
1447
|
+
this.simpleSexpr(sexpr);
|
999
1448
|
|
1000
1449
|
// now that the simple mustache is resolved, we need to
|
1001
1450
|
// evaluate it by executing `blockHelperMissing`
|
@@ -1004,7 +1453,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1004
1453
|
this.opcode('emptyHash');
|
1005
1454
|
this.opcode('blockValue');
|
1006
1455
|
} else {
|
1007
|
-
this.
|
1456
|
+
this.ambiguousSexpr(sexpr, program, inverse);
|
1008
1457
|
|
1009
1458
|
// now that the simple mustache is resolved, we need to
|
1010
1459
|
// evaluate it by executing `blockHelperMissing`
|
@@ -1027,7 +1476,17 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1027
1476
|
val = pair[1];
|
1028
1477
|
|
1029
1478
|
if (this.options.stringParams) {
|
1479
|
+
if(val.depth) {
|
1480
|
+
this.addDepth(val.depth);
|
1481
|
+
}
|
1482
|
+
this.opcode('getContext', val.depth || 0);
|
1030
1483
|
this.opcode('pushStringParam', val.stringModeValue, val.type);
|
1484
|
+
|
1485
|
+
if (val.type === 'sexpr') {
|
1486
|
+
// Subexpressions get evaluated and passed in
|
1487
|
+
// in string params mode.
|
1488
|
+
this.sexpr(val);
|
1489
|
+
}
|
1031
1490
|
} else {
|
1032
1491
|
this.accept(val);
|
1033
1492
|
}
|
@@ -1056,26 +1515,17 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1056
1515
|
},
|
1057
1516
|
|
1058
1517
|
mustache: function(mustache) {
|
1059
|
-
|
1060
|
-
var type = this.classifyMustache(mustache);
|
1518
|
+
this.sexpr(mustache.sexpr);
|
1061
1519
|
|
1062
|
-
if
|
1063
|
-
this.simpleMustache(mustache);
|
1064
|
-
} else if (type === "helper") {
|
1065
|
-
this.helperMustache(mustache);
|
1066
|
-
} else {
|
1067
|
-
this.ambiguousMustache(mustache);
|
1068
|
-
}
|
1069
|
-
|
1070
|
-
if(mustache.escaped && !options.noEscape) {
|
1520
|
+
if(mustache.escaped && !this.options.noEscape) {
|
1071
1521
|
this.opcode('appendEscaped');
|
1072
1522
|
} else {
|
1073
1523
|
this.opcode('append');
|
1074
1524
|
}
|
1075
1525
|
},
|
1076
1526
|
|
1077
|
-
|
1078
|
-
var id =
|
1527
|
+
ambiguousSexpr: function(sexpr, program, inverse) {
|
1528
|
+
var id = sexpr.id,
|
1079
1529
|
name = id.parts[0],
|
1080
1530
|
isBlock = program != null || inverse != null;
|
1081
1531
|
|
@@ -1087,8 +1537,8 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1087
1537
|
this.opcode('invokeAmbiguous', name, isBlock);
|
1088
1538
|
},
|
1089
1539
|
|
1090
|
-
|
1091
|
-
var id =
|
1540
|
+
simpleSexpr: function(sexpr) {
|
1541
|
+
var id = sexpr.id;
|
1092
1542
|
|
1093
1543
|
if (id.type === 'DATA') {
|
1094
1544
|
this.DATA(id);
|
@@ -1104,16 +1554,28 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1104
1554
|
this.opcode('resolvePossibleLambda');
|
1105
1555
|
},
|
1106
1556
|
|
1107
|
-
|
1108
|
-
var params = this.setupFullMustacheParams(
|
1109
|
-
name =
|
1557
|
+
helperSexpr: function(sexpr, program, inverse) {
|
1558
|
+
var params = this.setupFullMustacheParams(sexpr, program, inverse),
|
1559
|
+
name = sexpr.id.parts[0];
|
1110
1560
|
|
1111
1561
|
if (this.options.knownHelpers[name]) {
|
1112
1562
|
this.opcode('invokeKnownHelper', params.length, name);
|
1113
|
-
} else if (this.knownHelpersOnly) {
|
1114
|
-
throw new
|
1563
|
+
} else if (this.options.knownHelpersOnly) {
|
1564
|
+
throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
|
1565
|
+
} else {
|
1566
|
+
this.opcode('invokeHelper', params.length, name, sexpr.isRoot);
|
1567
|
+
}
|
1568
|
+
},
|
1569
|
+
|
1570
|
+
sexpr: function(sexpr) {
|
1571
|
+
var type = this.classifySexpr(sexpr);
|
1572
|
+
|
1573
|
+
if (type === "simple") {
|
1574
|
+
this.simpleSexpr(sexpr);
|
1575
|
+
} else if (type === "helper") {
|
1576
|
+
this.helperSexpr(sexpr);
|
1115
1577
|
} else {
|
1116
|
-
this.
|
1578
|
+
this.ambiguousSexpr(sexpr);
|
1117
1579
|
}
|
1118
1580
|
},
|
1119
1581
|
|
@@ -1135,7 +1597,15 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1135
1597
|
|
1136
1598
|
DATA: function(data) {
|
1137
1599
|
this.options.data = true;
|
1138
|
-
|
1600
|
+
if (data.id.isScoped || data.id.depth) {
|
1601
|
+
throw new Exception('Scoped data references are not supported: ' + data.original, data);
|
1602
|
+
}
|
1603
|
+
|
1604
|
+
this.opcode('lookupData');
|
1605
|
+
var parts = data.id.parts;
|
1606
|
+
for(var i=0, l=parts.length; i<l; i++) {
|
1607
|
+
this.opcode('lookup', parts[i]);
|
1608
|
+
}
|
1139
1609
|
},
|
1140
1610
|
|
1141
1611
|
STRING: function(string) {
|
@@ -1162,7 +1632,6 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1162
1632
|
},
|
1163
1633
|
|
1164
1634
|
addDepth: function(depth) {
|
1165
|
-
if(isNaN(depth)) { throw new Error("EWOT"); }
|
1166
1635
|
if(depth === 0) { return; }
|
1167
1636
|
|
1168
1637
|
if(!this.depths[depth]) {
|
@@ -1171,14 +1640,14 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1171
1640
|
}
|
1172
1641
|
},
|
1173
1642
|
|
1174
|
-
|
1175
|
-
var isHelper =
|
1176
|
-
var isEligible =
|
1643
|
+
classifySexpr: function(sexpr) {
|
1644
|
+
var isHelper = sexpr.isHelper;
|
1645
|
+
var isEligible = sexpr.eligibleHelper;
|
1177
1646
|
var options = this.options;
|
1178
1647
|
|
1179
1648
|
// if ambiguous, we can possibly resolve the ambiguity now
|
1180
1649
|
if (isEligible && !isHelper) {
|
1181
|
-
var name =
|
1650
|
+
var name = sexpr.id.parts[0];
|
1182
1651
|
|
1183
1652
|
if (options.knownHelpers[name]) {
|
1184
1653
|
isHelper = true;
|
@@ -1205,35 +1674,27 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1205
1674
|
|
1206
1675
|
this.opcode('getContext', param.depth || 0);
|
1207
1676
|
this.opcode('pushStringParam', param.stringModeValue, param.type);
|
1677
|
+
|
1678
|
+
if (param.type === 'sexpr') {
|
1679
|
+
// Subexpressions get evaluated and passed in
|
1680
|
+
// in string params mode.
|
1681
|
+
this.sexpr(param);
|
1682
|
+
}
|
1208
1683
|
} else {
|
1209
1684
|
this[param.type](param);
|
1210
1685
|
}
|
1211
1686
|
}
|
1212
1687
|
},
|
1213
1688
|
|
1214
|
-
|
1215
|
-
var params =
|
1216
|
-
this.pushParams(params);
|
1217
|
-
|
1218
|
-
if(mustache.hash) {
|
1219
|
-
this.hash(mustache.hash);
|
1220
|
-
} else {
|
1221
|
-
this.opcode('emptyHash');
|
1222
|
-
}
|
1223
|
-
|
1224
|
-
return params;
|
1225
|
-
},
|
1226
|
-
|
1227
|
-
// this will replace setupMustacheParams when we're done
|
1228
|
-
setupFullMustacheParams: function(mustache, program, inverse) {
|
1229
|
-
var params = mustache.params;
|
1689
|
+
setupFullMustacheParams: function(sexpr, program, inverse) {
|
1690
|
+
var params = sexpr.params;
|
1230
1691
|
this.pushParams(params);
|
1231
1692
|
|
1232
1693
|
this.opcode('pushProgram', program);
|
1233
1694
|
this.opcode('pushProgram', inverse);
|
1234
1695
|
|
1235
|
-
if(
|
1236
|
-
this.hash(
|
1696
|
+
if (sexpr.hash) {
|
1697
|
+
this.hash(sexpr.hash);
|
1237
1698
|
} else {
|
1238
1699
|
this.opcode('emptyHash');
|
1239
1700
|
}
|
@@ -1242,22 +1703,99 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1242
1703
|
}
|
1243
1704
|
};
|
1244
1705
|
|
1245
|
-
|
1706
|
+
function precompile(input, options, env) {
|
1707
|
+
if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) {
|
1708
|
+
throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
|
1709
|
+
}
|
1710
|
+
|
1711
|
+
options = options || {};
|
1712
|
+
if (!('data' in options)) {
|
1713
|
+
options.data = true;
|
1714
|
+
}
|
1715
|
+
|
1716
|
+
var ast = env.parse(input);
|
1717
|
+
var environment = new env.Compiler().compile(ast, options);
|
1718
|
+
return new env.JavaScriptCompiler().compile(environment, options);
|
1719
|
+
}
|
1720
|
+
|
1721
|
+
__exports__.precompile = precompile;function compile(input, options, env) {
|
1722
|
+
if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) {
|
1723
|
+
throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
|
1724
|
+
}
|
1725
|
+
|
1726
|
+
options = options || {};
|
1727
|
+
|
1728
|
+
if (!('data' in options)) {
|
1729
|
+
options.data = true;
|
1730
|
+
}
|
1731
|
+
|
1732
|
+
var compiled;
|
1733
|
+
|
1734
|
+
function compileInput() {
|
1735
|
+
var ast = env.parse(input);
|
1736
|
+
var environment = new env.Compiler().compile(ast, options);
|
1737
|
+
var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
|
1738
|
+
return env.template(templateSpec);
|
1739
|
+
}
|
1740
|
+
|
1741
|
+
// Template is only compiled on first use and cached after that point.
|
1742
|
+
return function(context, options) {
|
1743
|
+
if (!compiled) {
|
1744
|
+
compiled = compileInput();
|
1745
|
+
}
|
1746
|
+
return compiled.call(this, context, options);
|
1747
|
+
};
|
1748
|
+
}
|
1749
|
+
|
1750
|
+
__exports__.compile = compile;
|
1751
|
+
return __exports__;
|
1752
|
+
})(__module5__);
|
1753
|
+
|
1754
|
+
// handlebars/compiler/javascript-compiler.js
|
1755
|
+
var __module11__ = (function(__dependency1__, __dependency2__) {
|
1756
|
+
"use strict";
|
1757
|
+
var __exports__;
|
1758
|
+
var COMPILER_REVISION = __dependency1__.COMPILER_REVISION;
|
1759
|
+
var REVISION_CHANGES = __dependency1__.REVISION_CHANGES;
|
1760
|
+
var log = __dependency1__.log;
|
1761
|
+
var Exception = __dependency2__;
|
1762
|
+
|
1763
|
+
function Literal(value) {
|
1246
1764
|
this.value = value;
|
1247
|
-
}
|
1765
|
+
}
|
1766
|
+
|
1767
|
+
function JavaScriptCompiler() {}
|
1248
1768
|
|
1249
1769
|
JavaScriptCompiler.prototype = {
|
1250
1770
|
// PUBLIC API: You can override these methods in a subclass to provide
|
1251
1771
|
// alternative compiled forms for name lookup and buffering semantics
|
1252
1772
|
nameLookup: function(parent, name /* , type*/) {
|
1773
|
+
var wrap,
|
1774
|
+
ret;
|
1775
|
+
if (parent.indexOf('depth') === 0) {
|
1776
|
+
wrap = true;
|
1777
|
+
}
|
1778
|
+
|
1253
1779
|
if (/^[0-9]+$/.test(name)) {
|
1254
|
-
|
1780
|
+
ret = parent + "[" + name + "]";
|
1255
1781
|
} else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
|
1256
|
-
|
1782
|
+
ret = parent + "." + name;
|
1257
1783
|
}
|
1258
1784
|
else {
|
1259
|
-
|
1785
|
+
ret = parent + "['" + name + "']";
|
1260
1786
|
}
|
1787
|
+
|
1788
|
+
if (wrap) {
|
1789
|
+
return '(' + parent + ' && ' + ret + ')';
|
1790
|
+
} else {
|
1791
|
+
return ret;
|
1792
|
+
}
|
1793
|
+
},
|
1794
|
+
|
1795
|
+
compilerInfo: function() {
|
1796
|
+
var revision = COMPILER_REVISION,
|
1797
|
+
versions = REVISION_CHANGES[revision];
|
1798
|
+
return "this.compilerInfo = ["+revision+",'"+versions+"'];\n";
|
1261
1799
|
},
|
1262
1800
|
|
1263
1801
|
appendToBuffer: function(string) {
|
@@ -1283,7 +1821,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1283
1821
|
this.environment = environment;
|
1284
1822
|
this.options = options || {};
|
1285
1823
|
|
1286
|
-
|
1824
|
+
log('debug', this.environment.disassemble() + "\n\n");
|
1287
1825
|
|
1288
1826
|
this.name = this.environment.name;
|
1289
1827
|
this.isChild = !!context;
|
@@ -1298,6 +1836,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1298
1836
|
this.stackSlot = 0;
|
1299
1837
|
this.stackVars = [];
|
1300
1838
|
this.registers = { list: [] };
|
1839
|
+
this.hashes = [];
|
1301
1840
|
this.compileStack = [];
|
1302
1841
|
this.inlineStack = [];
|
1303
1842
|
|
@@ -1307,7 +1846,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1307
1846
|
|
1308
1847
|
this.i = 0;
|
1309
1848
|
|
1310
|
-
for(l=opcodes.length; this.i<l; this.i++) {
|
1849
|
+
for(var l=opcodes.length; this.i<l; this.i++) {
|
1311
1850
|
opcode = opcodes[this.i];
|
1312
1851
|
|
1313
1852
|
if(opcode.opcode === 'DECLARE') {
|
@@ -1315,18 +1854,21 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1315
1854
|
} else {
|
1316
1855
|
this[opcode.opcode].apply(this, opcode.args);
|
1317
1856
|
}
|
1857
|
+
|
1858
|
+
// Reset the stripNext flag if it was not set by this operation.
|
1859
|
+
if (opcode.opcode !== this.stripNext) {
|
1860
|
+
this.stripNext = false;
|
1861
|
+
}
|
1318
1862
|
}
|
1319
1863
|
|
1320
|
-
|
1321
|
-
|
1864
|
+
// Flush any trailing content that might be pending.
|
1865
|
+
this.pushSource('');
|
1322
1866
|
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
},
|
1867
|
+
if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
|
1868
|
+
throw new Exception('Compile completed with content left on stack');
|
1869
|
+
}
|
1327
1870
|
|
1328
|
-
|
1329
|
-
this.i = this.i + 1;
|
1871
|
+
return this.createFunctionContext(asObject);
|
1330
1872
|
},
|
1331
1873
|
|
1332
1874
|
preamble: function() {
|
@@ -1334,8 +1876,9 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1334
1876
|
|
1335
1877
|
if (!this.isChild) {
|
1336
1878
|
var namespace = this.namespace;
|
1337
|
-
|
1338
|
-
|
1879
|
+
|
1880
|
+
var copies = "helpers = this.merge(helpers, " + namespace + ".helpers);";
|
1881
|
+
if (this.environment.usePartial) { copies = copies + " partials = this.merge(partials, " + namespace + ".partials);"; }
|
1339
1882
|
if (this.options.data) { copies = copies + " data = data || {};"; }
|
1340
1883
|
out.push(copies);
|
1341
1884
|
} else {
|
@@ -1364,7 +1907,9 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1364
1907
|
// Generate minimizer alias mappings
|
1365
1908
|
if (!this.isChild) {
|
1366
1909
|
for (var alias in this.context.aliases) {
|
1367
|
-
|
1910
|
+
if (this.context.aliases.hasOwnProperty(alias)) {
|
1911
|
+
this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];
|
1912
|
+
}
|
1368
1913
|
}
|
1369
1914
|
}
|
1370
1915
|
|
@@ -1378,7 +1923,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1378
1923
|
}
|
1379
1924
|
|
1380
1925
|
if (!this.environment.isSimple) {
|
1381
|
-
this.
|
1926
|
+
this.pushSource("return buffer;");
|
1382
1927
|
}
|
1383
1928
|
|
1384
1929
|
var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"];
|
@@ -1391,9 +1936,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1391
1936
|
var source = this.mergeSource();
|
1392
1937
|
|
1393
1938
|
if (!this.isChild) {
|
1394
|
-
|
1395
|
-
versions = Handlebars.REVISION_CHANGES[revision];
|
1396
|
-
source = "this.compilerInfo = ["+revision+",'"+versions+"'];\n"+source;
|
1939
|
+
source = this.compilerInfo()+source;
|
1397
1940
|
}
|
1398
1941
|
|
1399
1942
|
if (asObject) {
|
@@ -1402,7 +1945,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1402
1945
|
return Function.apply(this, params);
|
1403
1946
|
} else {
|
1404
1947
|
var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}';
|
1405
|
-
|
1948
|
+
log('debug', functionSource + "\n\n");
|
1406
1949
|
return functionSource;
|
1407
1950
|
}
|
1408
1951
|
},
|
@@ -1466,10 +2009,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1466
2009
|
var current = this.topStack();
|
1467
2010
|
params.splice(1, 0, current);
|
1468
2011
|
|
1469
|
-
|
1470
|
-
params[params.length-1] = 'options';
|
1471
|
-
|
1472
|
-
this.source.push("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }");
|
2012
|
+
this.pushSource("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }");
|
1473
2013
|
},
|
1474
2014
|
|
1475
2015
|
// [appendContent]
|
@@ -1479,7 +2019,28 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1479
2019
|
//
|
1480
2020
|
// Appends the string value of `content` to the current buffer
|
1481
2021
|
appendContent: function(content) {
|
1482
|
-
|
2022
|
+
if (this.pendingContent) {
|
2023
|
+
content = this.pendingContent + content;
|
2024
|
+
}
|
2025
|
+
if (this.stripNext) {
|
2026
|
+
content = content.replace(/^\s+/, '');
|
2027
|
+
}
|
2028
|
+
|
2029
|
+
this.pendingContent = content;
|
2030
|
+
},
|
2031
|
+
|
2032
|
+
// [strip]
|
2033
|
+
//
|
2034
|
+
// On stack, before: ...
|
2035
|
+
// On stack, after: ...
|
2036
|
+
//
|
2037
|
+
// Removes any trailing whitespace from the prior content node and flags
|
2038
|
+
// the next operation for stripping if it is a content node.
|
2039
|
+
strip: function() {
|
2040
|
+
if (this.pendingContent) {
|
2041
|
+
this.pendingContent = this.pendingContent.replace(/\s+$/, '');
|
2042
|
+
}
|
2043
|
+
this.stripNext = 'strip';
|
1483
2044
|
},
|
1484
2045
|
|
1485
2046
|
// [append]
|
@@ -1496,9 +2057,9 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1496
2057
|
// when we examine local
|
1497
2058
|
this.flushInline();
|
1498
2059
|
var local = this.popStack();
|
1499
|
-
this.
|
2060
|
+
this.pushSource("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }");
|
1500
2061
|
if (this.environment.isSimple) {
|
1501
|
-
this.
|
2062
|
+
this.pushSource("else { " + this.appendToBuffer("''") + " }");
|
1502
2063
|
}
|
1503
2064
|
},
|
1504
2065
|
|
@@ -1511,7 +2072,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1511
2072
|
appendEscaped: function() {
|
1512
2073
|
this.context.aliases.escapeExpression = 'this.escapeExpression';
|
1513
2074
|
|
1514
|
-
this.
|
2075
|
+
this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")"));
|
1515
2076
|
},
|
1516
2077
|
|
1517
2078
|
// [getContext]
|
@@ -1579,11 +2140,11 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1579
2140
|
// [lookupData]
|
1580
2141
|
//
|
1581
2142
|
// On stack, before: ...
|
1582
|
-
// On stack, after: data
|
2143
|
+
// On stack, after: data, ...
|
1583
2144
|
//
|
1584
|
-
// Push the
|
1585
|
-
lookupData: function(
|
1586
|
-
this.
|
2145
|
+
// Push the data lookup operator
|
2146
|
+
lookupData: function() {
|
2147
|
+
this.pushStackLiteral('data');
|
1587
2148
|
},
|
1588
2149
|
|
1589
2150
|
// [pushStringParam]
|
@@ -1599,10 +2160,14 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1599
2160
|
|
1600
2161
|
this.pushString(type);
|
1601
2162
|
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
2163
|
+
// If it's a subexpression, the string result
|
2164
|
+
// will be pushed after this opcode.
|
2165
|
+
if (type !== 'sexpr') {
|
2166
|
+
if (typeof string === 'string') {
|
2167
|
+
this.pushString(string);
|
2168
|
+
} else {
|
2169
|
+
this.pushStackLiteral(string);
|
2170
|
+
}
|
1606
2171
|
}
|
1607
2172
|
},
|
1608
2173
|
|
@@ -1610,19 +2175,25 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1610
2175
|
this.pushStackLiteral('{}');
|
1611
2176
|
|
1612
2177
|
if (this.options.stringParams) {
|
1613
|
-
this.
|
2178
|
+
this.push('{}'); // hashContexts
|
2179
|
+
this.push('{}'); // hashTypes
|
1614
2180
|
}
|
1615
2181
|
},
|
1616
2182
|
pushHash: function() {
|
1617
|
-
this.hash
|
2183
|
+
if (this.hash) {
|
2184
|
+
this.hashes.push(this.hash);
|
2185
|
+
}
|
2186
|
+
this.hash = {values: [], types: [], contexts: []};
|
1618
2187
|
},
|
1619
2188
|
popHash: function() {
|
1620
2189
|
var hash = this.hash;
|
1621
|
-
this.hash =
|
2190
|
+
this.hash = this.hashes.pop();
|
1622
2191
|
|
1623
2192
|
if (this.options.stringParams) {
|
1624
|
-
this.
|
2193
|
+
this.push('{' + hash.contexts.join(',') + '}');
|
2194
|
+
this.push('{' + hash.types.join(',') + '}');
|
1625
2195
|
}
|
2196
|
+
|
1626
2197
|
this.push('{\n ' + hash.values.join(',\n ') + '\n }');
|
1627
2198
|
},
|
1628
2199
|
|
@@ -1684,17 +2255,31 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1684
2255
|
// and pushes the helper's return value onto the stack.
|
1685
2256
|
//
|
1686
2257
|
// If the helper is not found, `helperMissing` is called.
|
1687
|
-
invokeHelper: function(paramSize, name) {
|
2258
|
+
invokeHelper: function(paramSize, name, isRoot) {
|
1688
2259
|
this.context.aliases.helperMissing = 'helpers.helperMissing';
|
2260
|
+
this.useRegister('helper');
|
1689
2261
|
|
1690
2262
|
var helper = this.lastHelper = this.setupHelper(paramSize, name, true);
|
2263
|
+
var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context');
|
1691
2264
|
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
2265
|
+
var lookup = 'helper = ' + helper.name + ' || ' + nonHelper;
|
2266
|
+
if (helper.paramsInit) {
|
2267
|
+
lookup += ',' + helper.paramsInit;
|
2268
|
+
}
|
2269
|
+
|
2270
|
+
this.push(
|
2271
|
+
'('
|
2272
|
+
+ lookup
|
2273
|
+
+ ',helper '
|
2274
|
+
+ '? helper.call(' + helper.callParams + ') '
|
2275
|
+
+ ': helperMissing.call(' + helper.helperMissingParams + '))');
|
2276
|
+
|
2277
|
+
// Always flush subexpressions. This is both to prevent the compounding size issue that
|
2278
|
+
// occurs when the code has to be duplicated for inlining and also to prevent errors
|
2279
|
+
// due to the incorrect options object being passed due to the shared register.
|
2280
|
+
if (!isRoot) {
|
2281
|
+
this.flushInline();
|
2282
|
+
}
|
1698
2283
|
},
|
1699
2284
|
|
1700
2285
|
// [invokeKnownHelper]
|
@@ -1723,8 +2308,9 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1723
2308
|
// `knownHelpersOnly` flags at compile-time.
|
1724
2309
|
invokeAmbiguous: function(name, helperCall) {
|
1725
2310
|
this.context.aliases.functionType = '"function"';
|
2311
|
+
this.useRegister('helper');
|
1726
2312
|
|
1727
|
-
this.
|
2313
|
+
this.emptyHash();
|
1728
2314
|
var helper = this.setupHelper(0, name, helperCall);
|
1729
2315
|
|
1730
2316
|
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
|
@@ -1732,8 +2318,11 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1732
2318
|
var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context');
|
1733
2319
|
var nextStack = this.nextStack();
|
1734
2320
|
|
1735
|
-
|
1736
|
-
|
2321
|
+
if (helper.paramsInit) {
|
2322
|
+
this.pushSource(helper.paramsInit);
|
2323
|
+
}
|
2324
|
+
this.pushSource('if (helper = ' + helperName + ') { ' + nextStack + ' = helper.call(' + helper.callParams + '); }');
|
2325
|
+
this.pushSource('else { helper = ' + nonHelper + '; ' + nextStack + ' = typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper; }');
|
1737
2326
|
},
|
1738
2327
|
|
1739
2328
|
// [invokePartial]
|
@@ -1763,14 +2352,18 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1763
2352
|
// and pushes the hash back onto the stack.
|
1764
2353
|
assignToHash: function(key) {
|
1765
2354
|
var value = this.popStack(),
|
2355
|
+
context,
|
1766
2356
|
type;
|
1767
2357
|
|
1768
2358
|
if (this.options.stringParams) {
|
1769
2359
|
type = this.popStack();
|
1770
|
-
this.popStack();
|
2360
|
+
context = this.popStack();
|
1771
2361
|
}
|
1772
2362
|
|
1773
2363
|
var hash = this.hash;
|
2364
|
+
if (context) {
|
2365
|
+
hash.contexts.push("'" + key + "': " + context);
|
2366
|
+
}
|
1774
2367
|
if (type) {
|
1775
2368
|
hash.types.push("'" + key + "': " + type);
|
1776
2369
|
}
|
@@ -1831,17 +2424,12 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1831
2424
|
else { programParams.push("depth" + (depth - 1)); }
|
1832
2425
|
}
|
1833
2426
|
|
1834
|
-
|
1835
|
-
return "self.program(" + programParams.join(", ") + ")";
|
1836
|
-
} else {
|
1837
|
-
programParams.shift();
|
1838
|
-
return "self.programWithDepth(" + programParams.join(", ") + ")";
|
1839
|
-
}
|
2427
|
+
return (depths.length === 0 ? "self.program(" : "self.programWithDepth(") + programParams.join(", ") + ")";
|
1840
2428
|
},
|
1841
2429
|
|
1842
2430
|
register: function(name, val) {
|
1843
2431
|
this.useRegister(name);
|
1844
|
-
this.
|
2432
|
+
this.pushSource(name + " = " + val + ";");
|
1845
2433
|
},
|
1846
2434
|
|
1847
2435
|
useRegister: function(name) {
|
@@ -1855,12 +2443,23 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1855
2443
|
return this.push(new Literal(item));
|
1856
2444
|
},
|
1857
2445
|
|
2446
|
+
pushSource: function(source) {
|
2447
|
+
if (this.pendingContent) {
|
2448
|
+
this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent)));
|
2449
|
+
this.pendingContent = undefined;
|
2450
|
+
}
|
2451
|
+
|
2452
|
+
if (source) {
|
2453
|
+
this.source.push(source);
|
2454
|
+
}
|
2455
|
+
},
|
2456
|
+
|
1858
2457
|
pushStack: function(item) {
|
1859
2458
|
this.flushInline();
|
1860
2459
|
|
1861
2460
|
var stack = this.incrStack();
|
1862
2461
|
if (item) {
|
1863
|
-
this.
|
2462
|
+
this.pushSource(stack + " = " + item + ";");
|
1864
2463
|
}
|
1865
2464
|
this.compileStack.push(stack);
|
1866
2465
|
return stack;
|
@@ -1869,7 +2468,9 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1869
2468
|
replaceStack: function(callback) {
|
1870
2469
|
var prefix = '',
|
1871
2470
|
inline = this.isInline(),
|
1872
|
-
stack
|
2471
|
+
stack,
|
2472
|
+
createdStack,
|
2473
|
+
usedLiteral;
|
1873
2474
|
|
1874
2475
|
// If we are currently inline then we want to merge the inline statement into the
|
1875
2476
|
// replacement statement via ','
|
@@ -1879,9 +2480,11 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1879
2480
|
if (top instanceof Literal) {
|
1880
2481
|
// Literals do not need to be inlined
|
1881
2482
|
stack = top.value;
|
2483
|
+
usedLiteral = true;
|
1882
2484
|
} else {
|
1883
2485
|
// Get or create the current stack name for use by the inline
|
1884
|
-
|
2486
|
+
createdStack = !this.stackSlot;
|
2487
|
+
var name = !createdStack ? this.topStackName() : this.incrStack();
|
1885
2488
|
|
1886
2489
|
prefix = '(' + this.push(name) + ' = ' + top + '),';
|
1887
2490
|
stack = this.topStack();
|
@@ -1893,9 +2496,12 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1893
2496
|
var item = callback.call(this, stack);
|
1894
2497
|
|
1895
2498
|
if (inline) {
|
1896
|
-
if (
|
2499
|
+
if (!usedLiteral) {
|
1897
2500
|
this.popStack();
|
1898
2501
|
}
|
2502
|
+
if (createdStack) {
|
2503
|
+
this.stackSlot--;
|
2504
|
+
}
|
1899
2505
|
this.push('(' + prefix + item + ')');
|
1900
2506
|
} else {
|
1901
2507
|
// Prevent modification of the context depth variable. Through replaceStack
|
@@ -1903,7 +2509,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1903
2509
|
stack = this.nextStack();
|
1904
2510
|
}
|
1905
2511
|
|
1906
|
-
this.
|
2512
|
+
this.pushSource(stack + " = (" + prefix + item + ");");
|
1907
2513
|
}
|
1908
2514
|
return stack;
|
1909
2515
|
},
|
@@ -1946,6 +2552,9 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1946
2552
|
return item.value;
|
1947
2553
|
} else {
|
1948
2554
|
if (!inline) {
|
2555
|
+
if (!this.stackSlot) {
|
2556
|
+
throw new Exception('Invalid stack pop');
|
2557
|
+
}
|
1949
2558
|
this.stackSlot--;
|
1950
2559
|
}
|
1951
2560
|
return item;
|
@@ -1968,29 +2577,35 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
1968
2577
|
.replace(/\\/g, '\\\\')
|
1969
2578
|
.replace(/"/g, '\\"')
|
1970
2579
|
.replace(/\n/g, '\\n')
|
1971
|
-
.replace(/\r/g, '\\r')
|
2580
|
+
.replace(/\r/g, '\\r')
|
2581
|
+
.replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
|
2582
|
+
.replace(/\u2029/g, '\\u2029') + '"';
|
1972
2583
|
},
|
1973
2584
|
|
1974
2585
|
setupHelper: function(paramSize, name, missingParams) {
|
1975
|
-
var params = []
|
1976
|
-
|
2586
|
+
var params = [],
|
2587
|
+
paramsInit = this.setupParams(paramSize, params, missingParams);
|
1977
2588
|
var foundHelper = this.nameLookup('helpers', name, 'helper');
|
1978
2589
|
|
1979
2590
|
return {
|
1980
2591
|
params: params,
|
2592
|
+
paramsInit: paramsInit,
|
1981
2593
|
name: foundHelper,
|
1982
2594
|
callParams: ["depth0"].concat(params).join(", "),
|
1983
2595
|
helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ")
|
1984
2596
|
};
|
1985
2597
|
},
|
1986
2598
|
|
1987
|
-
|
1988
|
-
// to fill in
|
1989
|
-
setupParams: function(paramSize, params, useRegister) {
|
2599
|
+
setupOptions: function(paramSize, params) {
|
1990
2600
|
var options = [], contexts = [], types = [], param, inverse, program;
|
1991
2601
|
|
1992
2602
|
options.push("hash:" + this.popStack());
|
1993
2603
|
|
2604
|
+
if (this.options.stringParams) {
|
2605
|
+
options.push("hashTypes:" + this.popStack());
|
2606
|
+
options.push("hashContexts:" + this.popStack());
|
2607
|
+
}
|
2608
|
+
|
1994
2609
|
inverse = this.popStack();
|
1995
2610
|
program = this.popStack();
|
1996
2611
|
|
@@ -2003,7 +2618,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
2003
2618
|
}
|
2004
2619
|
|
2005
2620
|
if (!inverse) {
|
2006
|
-
|
2621
|
+
this.context.aliases.self = "this";
|
2007
2622
|
inverse = "self.noop";
|
2008
2623
|
}
|
2009
2624
|
|
@@ -2024,21 +2639,28 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
2024
2639
|
if (this.options.stringParams) {
|
2025
2640
|
options.push("contexts:[" + contexts.join(",") + "]");
|
2026
2641
|
options.push("types:[" + types.join(",") + "]");
|
2027
|
-
options.push("hashTypes:hashTypes");
|
2028
2642
|
}
|
2029
2643
|
|
2030
2644
|
if(this.options.data) {
|
2031
2645
|
options.push("data:data");
|
2032
2646
|
}
|
2033
2647
|
|
2034
|
-
|
2648
|
+
return options;
|
2649
|
+
},
|
2650
|
+
|
2651
|
+
// the params and contexts arguments are passed in arrays
|
2652
|
+
// to fill in
|
2653
|
+
setupParams: function(paramSize, params, useRegister) {
|
2654
|
+
var options = '{' + this.setupOptions(paramSize, params).join(',') + '}';
|
2655
|
+
|
2035
2656
|
if (useRegister) {
|
2036
|
-
this.
|
2657
|
+
this.useRegister('options');
|
2037
2658
|
params.push('options');
|
2659
|
+
return 'options=' + options;
|
2038
2660
|
} else {
|
2039
2661
|
params.push(options);
|
2662
|
+
return '';
|
2040
2663
|
}
|
2041
|
-
return params.join(", ");
|
2042
2664
|
}
|
2043
2665
|
};
|
2044
2666
|
|
@@ -2067,135 +2689,58 @@ Handlebars.JavaScriptCompiler = function() {};
|
|
2067
2689
|
}
|
2068
2690
|
|
2069
2691
|
JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
|
2070
|
-
if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]
|
2692
|
+
if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name)) {
|
2071
2693
|
return true;
|
2072
2694
|
}
|
2073
2695
|
return false;
|
2074
2696
|
};
|
2075
2697
|
|
2076
|
-
|
2077
|
-
|
2078
|
-
|
2079
|
-
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
|
2088
|
-
var
|
2089
|
-
|
2090
|
-
|
2091
|
-
|
2092
|
-
|
2093
|
-
|
2094
|
-
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2098
|
-
|
2099
|
-
|
2100
|
-
|
2101
|
-
|
2102
|
-
function compile() {
|
2103
|
-
var ast = Handlebars.parse(input);
|
2104
|
-
var environment = new Handlebars.Compiler().compile(ast, options);
|
2105
|
-
var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
|
2106
|
-
return Handlebars.template(templateSpec);
|
2107
|
-
}
|
2108
|
-
|
2109
|
-
// Template is only compiled on first use and cached after that point.
|
2110
|
-
return function(context, options) {
|
2111
|
-
if (!compiled) {
|
2112
|
-
compiled = compile();
|
2113
|
-
}
|
2114
|
-
return compiled.call(this, context, options);
|
2115
|
-
};
|
2116
|
-
};
|
2117
|
-
;
|
2118
|
-
// lib/handlebars/runtime.js
|
2119
|
-
Handlebars.VM = {
|
2120
|
-
template: function(templateSpec) {
|
2121
|
-
// Just add water
|
2122
|
-
var container = {
|
2123
|
-
escapeExpression: Handlebars.Utils.escapeExpression,
|
2124
|
-
invokePartial: Handlebars.VM.invokePartial,
|
2125
|
-
programs: [],
|
2126
|
-
program: function(i, fn, data) {
|
2127
|
-
var programWrapper = this.programs[i];
|
2128
|
-
if(data) {
|
2129
|
-
return Handlebars.VM.program(fn, data);
|
2130
|
-
} else if(programWrapper) {
|
2131
|
-
return programWrapper;
|
2132
|
-
} else {
|
2133
|
-
programWrapper = this.programs[i] = Handlebars.VM.program(fn);
|
2134
|
-
return programWrapper;
|
2135
|
-
}
|
2136
|
-
},
|
2137
|
-
programWithDepth: Handlebars.VM.programWithDepth,
|
2138
|
-
noop: Handlebars.VM.noop,
|
2139
|
-
compilerInfo: null
|
2698
|
+
__exports__ = JavaScriptCompiler;
|
2699
|
+
return __exports__;
|
2700
|
+
})(__module2__, __module5__);
|
2701
|
+
|
2702
|
+
// handlebars.js
|
2703
|
+
var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
|
2704
|
+
"use strict";
|
2705
|
+
var __exports__;
|
2706
|
+
/*globals Handlebars: true */
|
2707
|
+
var Handlebars = __dependency1__;
|
2708
|
+
|
2709
|
+
// Compiler imports
|
2710
|
+
var AST = __dependency2__;
|
2711
|
+
var Parser = __dependency3__.parser;
|
2712
|
+
var parse = __dependency3__.parse;
|
2713
|
+
var Compiler = __dependency4__.Compiler;
|
2714
|
+
var compile = __dependency4__.compile;
|
2715
|
+
var precompile = __dependency4__.precompile;
|
2716
|
+
var JavaScriptCompiler = __dependency5__;
|
2717
|
+
|
2718
|
+
var _create = Handlebars.create;
|
2719
|
+
var create = function() {
|
2720
|
+
var hb = _create();
|
2721
|
+
|
2722
|
+
hb.compile = function(input, options) {
|
2723
|
+
return compile(input, options, hb);
|
2140
2724
|
};
|
2141
|
-
|
2142
|
-
|
2143
|
-
options = options || {};
|
2144
|
-
var result = templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);
|
2145
|
-
|
2146
|
-
var compilerInfo = container.compilerInfo || [],
|
2147
|
-
compilerRevision = compilerInfo[0] || 1,
|
2148
|
-
currentRevision = Handlebars.COMPILER_REVISION;
|
2149
|
-
|
2150
|
-
if (compilerRevision !== currentRevision) {
|
2151
|
-
if (compilerRevision < currentRevision) {
|
2152
|
-
var runtimeVersions = Handlebars.REVISION_CHANGES[currentRevision],
|
2153
|
-
compilerVersions = Handlebars.REVISION_CHANGES[compilerRevision];
|
2154
|
-
throw "Template was precompiled with an older version of Handlebars than the current runtime. "+
|
2155
|
-
"Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").";
|
2156
|
-
} else {
|
2157
|
-
// Use the embedded version info since the runtime doesn't know about this revision yet
|
2158
|
-
throw "Template was precompiled with a newer version of Handlebars than the current runtime. "+
|
2159
|
-
"Please update your runtime to a newer version ("+compilerInfo[1]+").";
|
2160
|
-
}
|
2161
|
-
}
|
2162
|
-
|
2163
|
-
return result;
|
2725
|
+
hb.precompile = function (input, options) {
|
2726
|
+
return precompile(input, options, hb);
|
2164
2727
|
};
|
2165
|
-
},
|
2166
2728
|
|
2167
|
-
|
2168
|
-
|
2729
|
+
hb.AST = AST;
|
2730
|
+
hb.Compiler = Compiler;
|
2731
|
+
hb.JavaScriptCompiler = JavaScriptCompiler;
|
2732
|
+
hb.Parser = Parser;
|
2733
|
+
hb.parse = parse;
|
2169
2734
|
|
2170
|
-
return
|
2171
|
-
|
2172
|
-
|
2173
|
-
return fn.apply(this, [context, options.data || data].concat(args));
|
2174
|
-
};
|
2175
|
-
},
|
2176
|
-
program: function(fn, data) {
|
2177
|
-
return function(context, options) {
|
2178
|
-
options = options || {};
|
2735
|
+
return hb;
|
2736
|
+
};
|
2179
2737
|
|
2180
|
-
|
2181
|
-
|
2182
|
-
},
|
2183
|
-
noop: function() { return ""; },
|
2184
|
-
invokePartial: function(partial, name, context, helpers, partials, data) {
|
2185
|
-
var options = { helpers: helpers, partials: partials, data: data };
|
2738
|
+
Handlebars = create();
|
2739
|
+
Handlebars.create = create;
|
2186
2740
|
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2190
|
-
return partial(context, options);
|
2191
|
-
} else if (!Handlebars.compile) {
|
2192
|
-
throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
|
2193
|
-
} else {
|
2194
|
-
partials[name] = Handlebars.compile(partial, {data: data !== undefined});
|
2195
|
-
return partials[name](context, options);
|
2196
|
-
}
|
2197
|
-
}
|
2198
|
-
};
|
2741
|
+
__exports__ = Handlebars;
|
2742
|
+
return __exports__;
|
2743
|
+
})(__module1__, __module7__, __module8__, __module10__, __module11__);
|
2199
2744
|
|
2200
|
-
|
2201
|
-
;
|
2745
|
+
return __module0__;
|
2746
|
+
})();
|