handlebars_assets 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +5 -5
- data/README.md +2 -1
- data/lib/handlebars_assets/config.rb +1 -0
- data/lib/handlebars_assets/version.rb +1 -1
- data/test/patch/patch.js +9 -11
- data/vendor/assets/javascripts/handlebars.js +1246 -1208
- data/vendor/assets/javascripts/handlebars.runtime.js +96 -72
- metadata +26 -41
@@ -22,31 +22,45 @@ 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.0-rc.
|
33
|
-
Handlebars.COMPILER_REVISION =
|
32
|
+
Handlebars.VERSION = "1.0.0-rc.4";
|
33
|
+
Handlebars.COMPILER_REVISION = 3;
|
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: '
|
37
|
+
2: '== 1.0.0-rc.3',
|
38
|
+
3: '>= 1.0.0-rc.4'
|
38
39
|
};
|
39
40
|
|
40
41
|
Handlebars.helpers = {};
|
41
42
|
Handlebars.partials = {};
|
42
43
|
|
44
|
+
var toString = Object.prototype.toString,
|
45
|
+
functionType = '[object Function]',
|
46
|
+
objectType = '[object Object]';
|
47
|
+
|
43
48
|
Handlebars.registerHelper = function(name, fn, inverse) {
|
44
|
-
if(
|
45
|
-
|
49
|
+
if (toString.call(name) === objectType) {
|
50
|
+
if (inverse || fn) { throw new Handlebars.Exception('Arg not supported with multiple helpers'); }
|
51
|
+
Handlebars.Utils.extend(this.helpers, name);
|
52
|
+
} else {
|
53
|
+
if (inverse) { fn.not = inverse; }
|
54
|
+
this.helpers[name] = fn;
|
55
|
+
}
|
46
56
|
};
|
47
57
|
|
48
58
|
Handlebars.registerPartial = function(name, str) {
|
49
|
-
|
59
|
+
if (toString.call(name) === objectType) {
|
60
|
+
Handlebars.Utils.extend(this.partials, name);
|
61
|
+
} else {
|
62
|
+
this.partials[name] = str;
|
63
|
+
}
|
50
64
|
};
|
51
65
|
|
52
66
|
Handlebars.registerHelper('helperMissing', function(arg) {
|
@@ -57,13 +71,9 @@ Handlebars.registerHelper('helperMissing', function(arg) {
|
|
57
71
|
}
|
58
72
|
});
|
59
73
|
|
60
|
-
var toString = Object.prototype.toString, functionType = "[object Function]";
|
61
|
-
|
62
74
|
Handlebars.registerHelper('blockHelperMissing', function(context, options) {
|
63
75
|
var inverse = options.inverse || function() {}, fn = options.fn;
|
64
76
|
|
65
|
-
|
66
|
-
var ret = "";
|
67
77
|
var type = toString.call(context);
|
68
78
|
|
69
79
|
if(type === functionType) { context = context.call(this); }
|
@@ -154,23 +164,17 @@ Handlebars.registerHelper('if', function(context, options) {
|
|
154
164
|
});
|
155
165
|
|
156
166
|
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);
|
167
|
+
return Handlebars.helpers['if'].call(this, context, {fn: options.inverse, inverse: options.fn});
|
162
168
|
});
|
163
169
|
|
164
170
|
Handlebars.registerHelper('with', function(context, options) {
|
165
|
-
return options.fn(context);
|
171
|
+
if (!Handlebars.Utils.isEmpty(context)) return options.fn(context);
|
166
172
|
});
|
167
173
|
|
168
174
|
Handlebars.registerHelper('log', function(context, options) {
|
169
175
|
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
|
170
176
|
Handlebars.log(level, context);
|
171
177
|
});
|
172
|
-
|
173
|
-
}(this.Handlebars));
|
174
178
|
;
|
175
179
|
// lib/handlebars/utils.js
|
176
180
|
|
@@ -194,48 +198,61 @@ Handlebars.SafeString.prototype.toString = function() {
|
|
194
198
|
return this.string.toString();
|
195
199
|
};
|
196
200
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
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
|
-
}
|
201
|
+
var escape = {
|
202
|
+
"&": "&",
|
203
|
+
"<": "<",
|
204
|
+
">": ">",
|
205
|
+
'"': """,
|
206
|
+
"'": "'",
|
207
|
+
"`": "`"
|
208
|
+
};
|
209
|
+
|
210
|
+
var badChars = /[&<>"'`]/g;
|
211
|
+
var possible = /[&<>"'`]/;
|
212
|
+
|
213
|
+
var escapeChar = function(chr) {
|
214
|
+
return escape[chr] || "&";
|
215
|
+
};
|
222
216
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
if (!value && value !== 0) {
|
229
|
-
return true;
|
230
|
-
} else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
|
231
|
-
return true;
|
232
|
-
} else {
|
233
|
-
return false;
|
217
|
+
Handlebars.Utils = {
|
218
|
+
extend: function(obj, value) {
|
219
|
+
for(var key in value) {
|
220
|
+
if(value.hasOwnProperty(key)) {
|
221
|
+
obj[key] = value[key];
|
234
222
|
}
|
235
223
|
}
|
236
|
-
}
|
237
|
-
|
224
|
+
},
|
225
|
+
|
226
|
+
escapeExpression: function(string) {
|
227
|
+
// don't escape SafeStrings, since they're already safe
|
228
|
+
if (string instanceof Handlebars.SafeString) {
|
229
|
+
return string.toString();
|
230
|
+
} else if (string == null || string === false) {
|
231
|
+
return "";
|
232
|
+
}
|
233
|
+
|
234
|
+
// Force a string conversion as this will be done by the append regardless and
|
235
|
+
// the regex test will do this transparently behind the scenes, causing issues if
|
236
|
+
// an object's to string has escaped characters in it.
|
237
|
+
string = string.toString();
|
238
|
+
|
239
|
+
if(!possible.test(string)) { return string; }
|
240
|
+
return string.replace(badChars, escapeChar);
|
241
|
+
},
|
242
|
+
|
243
|
+
isEmpty: function(value) {
|
244
|
+
if (!value && value !== 0) {
|
245
|
+
return true;
|
246
|
+
} else if(toString.call(value) === "[object Array]" && value.length === 0) {
|
247
|
+
return true;
|
248
|
+
} else {
|
249
|
+
return false;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
};
|
253
|
+
;
|
238
254
|
// lib/handlebars/runtime.js
|
255
|
+
|
239
256
|
Handlebars.VM = {
|
240
257
|
template: function(templateSpec) {
|
241
258
|
// Just add water
|
@@ -246,13 +263,11 @@ Handlebars.VM = {
|
|
246
263
|
program: function(i, fn, data) {
|
247
264
|
var programWrapper = this.programs[i];
|
248
265
|
if(data) {
|
249
|
-
|
250
|
-
} else if(programWrapper) {
|
251
|
-
|
252
|
-
} else {
|
253
|
-
programWrapper = this.programs[i] = Handlebars.VM.program(fn);
|
254
|
-
return programWrapper;
|
266
|
+
programWrapper = Handlebars.VM.program(i, fn, data);
|
267
|
+
} else if (!programWrapper) {
|
268
|
+
programWrapper = this.programs[i] = Handlebars.VM.program(i, fn);
|
255
269
|
}
|
270
|
+
return programWrapper;
|
256
271
|
},
|
257
272
|
programWithDepth: Handlebars.VM.programWithDepth,
|
258
273
|
noop: Handlebars.VM.noop,
|
@@ -284,21 +299,27 @@ Handlebars.VM = {
|
|
284
299
|
};
|
285
300
|
},
|
286
301
|
|
287
|
-
programWithDepth: function(fn, data
|
288
|
-
var args = Array.prototype.slice.call(arguments,
|
302
|
+
programWithDepth: function(i, fn, data /*, $depth */) {
|
303
|
+
var args = Array.prototype.slice.call(arguments, 3);
|
289
304
|
|
290
|
-
|
305
|
+
var program = function(context, options) {
|
291
306
|
options = options || {};
|
292
307
|
|
293
308
|
return fn.apply(this, [context, options.data || data].concat(args));
|
294
309
|
};
|
310
|
+
program.program = i;
|
311
|
+
program.depth = args.length;
|
312
|
+
return program;
|
295
313
|
},
|
296
|
-
program: function(fn, data) {
|
297
|
-
|
314
|
+
program: function(i, fn, data) {
|
315
|
+
var program = function(context, options) {
|
298
316
|
options = options || {};
|
299
317
|
|
300
318
|
return fn(context, options.data || data);
|
301
319
|
};
|
320
|
+
program.program = i;
|
321
|
+
program.depth = 0;
|
322
|
+
return program;
|
302
323
|
},
|
303
324
|
noop: function() { return ""; },
|
304
325
|
invokePartial: function(partial, name, context, helpers, partials, data) {
|
@@ -319,3 +340,6 @@ Handlebars.VM = {
|
|
319
340
|
|
320
341
|
Handlebars.template = Handlebars.VM.template;
|
321
342
|
;
|
343
|
+
// lib/handlebars/browser-suffix.js
|
344
|
+
})(Handlebars);
|
345
|
+
;
|
metadata
CHANGED
@@ -1,128 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: handlebars_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.12.0
|
4
|
+
version: 0.12.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Les Hill
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-05-21 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: execjs
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 1.2.9
|
22
15
|
requirement: !ruby/object:Gem::Requirement
|
23
|
-
none: false
|
24
16
|
requirements:
|
25
17
|
- - ! '>='
|
26
18
|
- !ruby/object:Gem::Version
|
27
19
|
version: 1.2.9
|
28
20
|
type: :runtime
|
29
21
|
prerelease: false
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: tilt
|
32
22
|
version_requirements: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
23
|
requirements:
|
35
24
|
- - ! '>='
|
36
25
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
26
|
+
version: 1.2.9
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tilt
|
38
29
|
requirement: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
30
|
requirements:
|
41
31
|
- - ! '>='
|
42
32
|
- !ruby/object:Gem::Version
|
43
33
|
version: '0'
|
44
34
|
type: :runtime
|
45
35
|
prerelease: false
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: sprockets
|
48
36
|
version_requirements: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
37
|
requirements:
|
51
38
|
- - ! '>='
|
52
39
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sprockets
|
54
43
|
requirement: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
44
|
requirements:
|
57
45
|
- - ! '>='
|
58
46
|
- !ruby/object:Gem::Version
|
59
47
|
version: 2.0.3
|
60
48
|
type: :runtime
|
61
49
|
prerelease: false
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: debugger
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
51
|
requirements:
|
67
52
|
- - ! '>='
|
68
53
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
54
|
+
version: 2.0.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: debugger
|
70
57
|
requirement: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
58
|
requirements:
|
73
59
|
- - ! '>='
|
74
60
|
- !ruby/object:Gem::Version
|
75
61
|
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: haml
|
80
64
|
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
65
|
requirements:
|
83
66
|
- - ! '>='
|
84
67
|
- !ruby/object:Gem::Version
|
85
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: haml
|
86
71
|
requirement: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
72
|
requirements:
|
89
73
|
- - ! '>='
|
90
74
|
- !ruby/object:Gem::Version
|
91
75
|
version: '0'
|
92
76
|
type: :development
|
93
77
|
prerelease: false
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rake
|
96
78
|
version_requirements: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
79
|
requirements:
|
99
80
|
- - ! '>='
|
100
81
|
- !ruby/object:Gem::Version
|
101
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
102
85
|
requirement: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
86
|
requirements:
|
105
87
|
- - ! '>='
|
106
88
|
- !ruby/object:Gem::Version
|
107
89
|
version: '0'
|
108
90
|
type: :development
|
109
91
|
prerelease: false
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: slim
|
112
92
|
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
93
|
requirements:
|
115
94
|
- - ! '>='
|
116
95
|
- !ruby/object:Gem::Version
|
117
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: slim
|
118
99
|
requirement: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
100
|
requirements:
|
121
101
|
- - ! '>='
|
122
102
|
- !ruby/object:Gem::Version
|
123
103
|
version: '0'
|
124
104
|
type: :development
|
125
105
|
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
126
111
|
description: Compile Handlebars templates in the Rails asset pipeline.
|
127
112
|
email:
|
128
113
|
- leshill@gmail.com
|
@@ -156,27 +141,26 @@ files:
|
|
156
141
|
- vendor/assets/javascripts/handlebars.runtime.js
|
157
142
|
homepage: ''
|
158
143
|
licenses: []
|
144
|
+
metadata: {}
|
159
145
|
post_install_message:
|
160
146
|
rdoc_options: []
|
161
147
|
require_paths:
|
162
148
|
- lib
|
163
149
|
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
-
none: false
|
165
150
|
requirements:
|
166
151
|
- - ! '>='
|
167
152
|
- !ruby/object:Gem::Version
|
168
153
|
version: '0'
|
169
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
|
-
none: false
|
171
155
|
requirements:
|
172
156
|
- - ! '>='
|
173
157
|
- !ruby/object:Gem::Version
|
174
158
|
version: '0'
|
175
159
|
requirements: []
|
176
160
|
rubyforge_project: handlebars_assets
|
177
|
-
rubygems_version:
|
161
|
+
rubygems_version: 2.0.3
|
178
162
|
signing_key:
|
179
|
-
specification_version:
|
163
|
+
specification_version: 4
|
180
164
|
summary: Compile Handlebars templates in the Rails asset pipeline.
|
181
165
|
test_files:
|
182
166
|
- test/edge/handlebars.js
|
@@ -186,3 +170,4 @@ test_files:
|
|
186
170
|
- test/handlebars_assets/tilt_handlebars_test.rb
|
187
171
|
- test/patch/patch.js
|
188
172
|
- test/test_helper.rb
|
173
|
+
has_rdoc:
|