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