handlebars-source 1.0.0.rc2 → 1.0.0.rc3
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.
- data/dist/handlebars.js +1158 -1159
- data/dist/handlebars.runtime.js +50 -55
- metadata +1 -1
data/dist/handlebars.runtime.js
CHANGED
|
@@ -22,19 +22,19 @@ THE SOFTWARE.
|
|
|
22
22
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
// lib/handlebars/
|
|
26
|
-
|
|
27
|
-
/*jshint eqnull:true*/
|
|
28
|
-
this.Handlebars = {};
|
|
25
|
+
// lib/handlebars/browser-prefix.js
|
|
26
|
+
var Handlebars = {};
|
|
29
27
|
|
|
30
|
-
(function(Handlebars) {
|
|
28
|
+
(function(Handlebars, undefined) {
|
|
29
|
+
;
|
|
30
|
+
// lib/handlebars/base.js
|
|
31
31
|
|
|
32
|
-
Handlebars.VERSION = "1.0.rc.
|
|
32
|
+
Handlebars.VERSION = "1.0.0-rc.3";
|
|
33
33
|
Handlebars.COMPILER_REVISION = 2;
|
|
34
34
|
|
|
35
35
|
Handlebars.REVISION_CHANGES = {
|
|
36
36
|
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
|
|
37
|
-
2: '>= 1.0.rc.3'
|
|
37
|
+
2: '>= 1.0.0-rc.3'
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
Handlebars.helpers = {};
|
|
@@ -62,8 +62,6 @@ var toString = Object.prototype.toString, functionType = "[object Function]";
|
|
|
62
62
|
Handlebars.registerHelper('blockHelperMissing', function(context, options) {
|
|
63
63
|
var inverse = options.inverse || function() {}, fn = options.fn;
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
var ret = "";
|
|
67
65
|
var type = toString.call(context);
|
|
68
66
|
|
|
69
67
|
if(type === functionType) { context = context.call(this); }
|
|
@@ -154,11 +152,7 @@ Handlebars.registerHelper('if', function(context, options) {
|
|
|
154
152
|
});
|
|
155
153
|
|
|
156
154
|
Handlebars.registerHelper('unless', function(context, options) {
|
|
157
|
-
|
|
158
|
-
options.fn = inverse;
|
|
159
|
-
options.inverse = fn;
|
|
160
|
-
|
|
161
|
-
return Handlebars.helpers['if'].call(this, context, options);
|
|
155
|
+
return Handlebars.helpers['if'].call(this, context, {fn: options.inverse, inverse: options.fn});
|
|
162
156
|
});
|
|
163
157
|
|
|
164
158
|
Handlebars.registerHelper('with', function(context, options) {
|
|
@@ -169,8 +163,6 @@ Handlebars.registerHelper('log', function(context, options) {
|
|
|
169
163
|
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
|
|
170
164
|
Handlebars.log(level, context);
|
|
171
165
|
});
|
|
172
|
-
|
|
173
|
-
}(this.Handlebars));
|
|
174
166
|
;
|
|
175
167
|
// lib/handlebars/utils.js
|
|
176
168
|
|
|
@@ -194,48 +186,48 @@ Handlebars.SafeString.prototype.toString = function() {
|
|
|
194
186
|
return this.string.toString();
|
|
195
187
|
};
|
|
196
188
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
var badChars = /[&<>"'`]/g;
|
|
208
|
-
var possible = /[&<>"'`]/;
|
|
209
|
-
|
|
210
|
-
var escapeChar = function(chr) {
|
|
211
|
-
return escape[chr] || "&";
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
Handlebars.Utils = {
|
|
215
|
-
escapeExpression: function(string) {
|
|
216
|
-
// don't escape SafeStrings, since they're already safe
|
|
217
|
-
if (string instanceof Handlebars.SafeString) {
|
|
218
|
-
return string.toString();
|
|
219
|
-
} else if (string == null || string === false) {
|
|
220
|
-
return "";
|
|
221
|
-
}
|
|
189
|
+
var escape = {
|
|
190
|
+
"&": "&",
|
|
191
|
+
"<": "<",
|
|
192
|
+
">": ">",
|
|
193
|
+
'"': """,
|
|
194
|
+
"'": "'",
|
|
195
|
+
"`": "`"
|
|
196
|
+
};
|
|
222
197
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
198
|
+
var badChars = /[&<>"'`]/g;
|
|
199
|
+
var possible = /[&<>"'`]/;
|
|
200
|
+
|
|
201
|
+
var escapeChar = function(chr) {
|
|
202
|
+
return escape[chr] || "&";
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
Handlebars.Utils = {
|
|
206
|
+
escapeExpression: function(string) {
|
|
207
|
+
// don't escape SafeStrings, since they're already safe
|
|
208
|
+
if (string instanceof Handlebars.SafeString) {
|
|
209
|
+
return string.toString();
|
|
210
|
+
} else if (string == null || string === false) {
|
|
211
|
+
return "";
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if(!possible.test(string)) { return string; }
|
|
215
|
+
return string.replace(badChars, escapeChar);
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
isEmpty: function(value) {
|
|
219
|
+
if (!value && value !== 0) {
|
|
220
|
+
return true;
|
|
221
|
+
} else if(toString.call(value) === "[object Array]" && value.length === 0) {
|
|
222
|
+
return true;
|
|
223
|
+
} else {
|
|
224
|
+
return false;
|
|
235
225
|
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
;
|
|
238
229
|
// lib/handlebars/runtime.js
|
|
230
|
+
|
|
239
231
|
Handlebars.VM = {
|
|
240
232
|
template: function(templateSpec) {
|
|
241
233
|
// Just add water
|
|
@@ -319,3 +311,6 @@ Handlebars.VM = {
|
|
|
319
311
|
|
|
320
312
|
Handlebars.template = Handlebars.VM.template;
|
|
321
313
|
;
|
|
314
|
+
// lib/handlebars/browser-suffix.js
|
|
315
|
+
})(Handlebars);
|
|
316
|
+
;
|