haml_coffee_assets 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,5 +15,6 @@ if defined?(Rails)
15
15
  require 'haml_coffee_assets/engine'
16
16
  else
17
17
  require 'sprockets'
18
+ require 'sprockets/engines'
18
19
  Sprockets.register_engine '.hamlc', HamlCoffeeAssets::HamlCoffeeTemplate
19
20
  end
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module HamlCoffeeAssets
4
- VERSION = '0.8.3' unless defined?(HamlCoffeeAssets::VERSION)
4
+ VERSION = '0.8.4' unless defined?(HamlCoffeeAssets::VERSION)
5
5
  end
@@ -26,7 +26,8 @@ require.resolve = (function () {
26
26
 
27
27
  if (require._core[x]) return x;
28
28
  var path = require.modules.path();
29
- var y = cwd || '.';
29
+ cwd = path.resolve('/', cwd);
30
+ var y = cwd || '/';
30
31
 
31
32
  if (x.match(/^(?:\.\.?\/|\/)/)) {
32
33
  var m = loadAsFileSync(path.resolve(y, x))
@@ -115,7 +116,11 @@ require.alias = function (from, to) {
115
116
  }
116
117
  var basedir = path.dirname(res);
117
118
 
118
- var keys = Object_keys(require.modules);
119
+ var keys = (Object.keys || function (obj) {
120
+ var res = [];
121
+ for (var key in obj) res.push(key)
122
+ return res;
123
+ })(require.modules);
119
124
 
120
125
  for (var i = 0; i < keys.length; i++) {
121
126
  var key = keys[i];
@@ -160,17 +165,34 @@ require.define = function (filename, fn) {
160
165
  };
161
166
  };
162
167
 
163
- var Object_keys = Object.keys || function (obj) {
164
- var res = [];
165
- for (var key in obj) res.push(key)
166
- return res;
167
- };
168
-
169
168
  if (typeof process === 'undefined') process = {};
170
169
 
171
- if (!process.nextTick) process.nextTick = function (fn) {
172
- setTimeout(fn, 0);
173
- };
170
+ if (!process.nextTick) process.nextTick = (function () {
171
+ var queue = [];
172
+ var canPost = typeof window !== 'undefined'
173
+ && window.postMessage && window.addEventListener
174
+ ;
175
+
176
+ if (canPost) {
177
+ window.addEventListener('message', function (ev) {
178
+ if (ev.source === window && ev.data === 'browserify-tick') {
179
+ ev.stopPropagation();
180
+ if (queue.length > 0) {
181
+ var fn = queue.shift();
182
+ fn();
183
+ }
184
+ }
185
+ }, true);
186
+ }
187
+
188
+ return function (fn) {
189
+ if (canPost) {
190
+ queue.push(fn);
191
+ window.postMessage('browserify-tick', '*');
192
+ }
193
+ else setTimeout(fn, 0);
194
+ };
195
+ })();
174
196
 
175
197
  if (!process.title) process.title = 'browser';
176
198
 
@@ -182,7 +204,7 @@ if (!process.binding) process.binding = function (name) {
182
204
  if (!process.cwd) process.cwd = function () { return '.' };
183
205
 
184
206
  require.define("path", function (require, module, exports, __dirname, __filename) {
185
- function filter (xs, fn) {
207
+ function filter (xs, fn) {
186
208
  var res = [];
187
209
  for (var i = 0; i < xs.length; i++) {
188
210
  if (fn(xs[i], i, xs)) res.push(xs[i]);
@@ -320,7 +342,7 @@ exports.extname = function(path) {
320
342
  });
321
343
 
322
344
  require.define("/haml-coffee.js", function (require, module, exports, __dirname, __filename) {
323
- (function() {
345
+ (function() {
324
346
  var Code, Comment, Filter, Haml, HamlCoffee, Node, Text, indent, whitespace;
325
347
 
326
348
  Node = require('./nodes/node');
@@ -697,7 +719,7 @@ require.define("/haml-coffee.js", function (require, module, exports, __dirname,
697
719
  });
698
720
 
699
721
  require.define("/nodes/node.js", function (require, module, exports, __dirname, __filename) {
700
- (function() {
722
+ (function() {
701
723
  var Node, escapeHTML;
702
724
 
703
725
  escapeHTML = require('../util/text').escapeHTML;
@@ -868,7 +890,7 @@ require.define("/nodes/node.js", function (require, module, exports, __dirname,
868
890
  });
869
891
 
870
892
  require.define("/util/text.js", function (require, module, exports, __dirname, __filename) {
871
- (function() {
893
+ (function() {
872
894
 
873
895
  module.exports = {
874
896
  whitespace: function(n) {
@@ -884,6 +906,10 @@ require.define("/util/text.js", function (require, module, exports, __dirname, _
884
906
  if (!text) return '';
885
907
  return text.replace(/"/g, '\\"');
886
908
  },
909
+ unescapeQuotes: function(text) {
910
+ if (!text) return '';
911
+ return text.replace(/\\"/g, '"');
912
+ },
887
913
  escapeHTML: function(text) {
888
914
  if (!text) return '';
889
915
  return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');
@@ -905,7 +931,7 @@ require.define("/util/text.js", function (require, module, exports, __dirname, _
905
931
  });
906
932
 
907
933
  require.define("/nodes/text.js", function (require, module, exports, __dirname, __filename) {
908
- (function() {
934
+ (function() {
909
935
  var Node, Text, escapeQuotes,
910
936
  __hasProp = Object.prototype.hasOwnProperty,
911
937
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
@@ -935,7 +961,7 @@ require.define("/nodes/text.js", function (require, module, exports, __dirname,
935
961
  });
936
962
 
937
963
  require.define("/nodes/haml.js", function (require, module, exports, __dirname, __filename) {
938
- (function() {
964
+ (function() {
939
965
  var Haml, Node, escapeQuotes,
940
966
  __hasProp = Object.prototype.hasOwnProperty,
941
967
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
@@ -1246,7 +1272,7 @@ require.define("/nodes/haml.js", function (require, module, exports, __dirname,
1246
1272
  });
1247
1273
 
1248
1274
  require.define("/nodes/code.js", function (require, module, exports, __dirname, __filename) {
1249
- (function() {
1275
+ (function() {
1250
1276
  var Code, Node,
1251
1277
  __hasProp = Object.prototype.hasOwnProperty,
1252
1278
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
@@ -1299,7 +1325,7 @@ require.define("/nodes/code.js", function (require, module, exports, __dirname,
1299
1325
  });
1300
1326
 
1301
1327
  require.define("/nodes/comment.js", function (require, module, exports, __dirname, __filename) {
1302
- (function() {
1328
+ (function() {
1303
1329
  var Comment, Node,
1304
1330
  __hasProp = Object.prototype.hasOwnProperty,
1305
1331
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
@@ -1344,8 +1370,8 @@ require.define("/nodes/comment.js", function (require, module, exports, __dirnam
1344
1370
  });
1345
1371
 
1346
1372
  require.define("/nodes/filter.js", function (require, module, exports, __dirname, __filename) {
1347
- (function() {
1348
- var Filter, Node, whitespace,
1373
+ (function() {
1374
+ var Filter, Node, unescapeQuotes, whitespace,
1349
1375
  __hasProp = Object.prototype.hasOwnProperty,
1350
1376
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
1351
1377
 
@@ -1353,6 +1379,8 @@ require.define("/nodes/filter.js", function (require, module, exports, __dirname
1353
1379
 
1354
1380
  whitespace = require('../util/text').whitespace;
1355
1381
 
1382
+ unescapeQuotes = require('../util/text').unescapeQuotes;
1383
+
1356
1384
  module.exports = Filter = (function(_super) {
1357
1385
 
1358
1386
  __extends(Filter, _super);
@@ -1451,7 +1479,7 @@ require.define("/nodes/filter.js", function (require, module, exports, __dirname
1451
1479
  output.push(this.markText("" + (whitespace(indent)) + line));
1452
1480
  break;
1453
1481
  case 'run':
1454
- output.push(this.markRunningCode("" + line));
1482
+ output.push(this.markRunningCode("" + (unescapeQuotes(line))));
1455
1483
  }
1456
1484
  _results.push(empty = 0);
1457
1485
  }
@@ -49,7 +49,7 @@ window.HAML.extend ||= (globals, locals) ->
49
49
 
50
50
  else if Object.append
51
51
  Object.append(Object.append({}, globals), locals)
52
-
52
+
53
53
  else if Object.extend
54
54
  Object.extend(Object.extend({}, globals), locals)
55
55
 
@@ -97,7 +97,7 @@ window.HAML.findAndPreserve ||= (text) ->
97
97
  # @param [Function] fn the text generating function
98
98
  # @return [String] the surrounded text
99
99
  #
100
- surround: (start, end, fn) ->
100
+ window.HAML.surround ||= (start, end, fn) ->
101
101
  start + fn() + end
102
102
 
103
103
  # The succeed helper appends text to the function output
@@ -107,7 +107,7 @@ surround: (start, end, fn) ->
107
107
  # @param [Function] fn the text generating function
108
108
  # @return [String] the succeeded text
109
109
  #
110
- succeed: (end, fn) ->
110
+ window.HAML.succeed ||= (end, fn) ->
111
111
  fn() + end
112
112
 
113
113
  # The precede helper prepends text to the function output
@@ -117,5 +117,5 @@ succeed: (end, fn) ->
117
117
  # @param [Function] fn the text generating function
118
118
  # @return [String] the preeceded text
119
119
  #
120
- precede: (start, fn) ->
120
+ window.HAML.precede ||= (start, fn) ->
121
121
  start + fn()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml_coffee_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-26 00:00:00.000000000Z
12
+ date: 2012-03-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: execjs
16
- requirement: &70263946976220 !ruby/object:Gem::Requirement
16
+ requirement: &70318308640140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.2.9
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70263946976220
24
+ version_requirements: *70318308640140
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tilt
27
- requirement: &70263946975760 !ruby/object:Gem::Requirement
27
+ requirement: &70318308639220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.3.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70263946975760
35
+ version_requirements: *70318308639220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sprockets
38
- requirement: &70263946975300 !ruby/object:Gem::Requirement
38
+ requirement: &70318308637240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.0.3
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70263946975300
46
+ version_requirements: *70318308637240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70263946974920 !ruby/object:Gem::Requirement
49
+ requirement: &70318308636440 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70263946974920
57
+ version_requirements: *70318308636440
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: railties
60
- requirement: &70263946974380 !ruby/object:Gem::Requirement
60
+ requirement: &70318308620620 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '3.1'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70263946974380
68
+ version_requirements: *70318308620620
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &70263946973960 !ruby/object:Gem::Requirement
71
+ requirement: &70318308619420 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70263946973960
79
+ version_requirements: *70318308619420
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: guard-rspec
82
- requirement: &70263946973500 !ruby/object:Gem::Requirement
82
+ requirement: &70318308617980 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70263946973500
90
+ version_requirements: *70318308617980
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: yard
93
- requirement: &70263946973080 !ruby/object:Gem::Requirement
93
+ requirement: &70318308617220 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70263946973080
101
+ version_requirements: *70318308617220
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: redcarpet
104
- requirement: &70263946972660 !ruby/object:Gem::Requirement
104
+ requirement: &70318308616520 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70263946972660
112
+ version_requirements: *70318308616520
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: pry
115
- requirement: &70263946972240 !ruby/object:Gem::Requirement
115
+ requirement: &70318308615340 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70263946972240
123
+ version_requirements: *70318308615340
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: rake
126
- requirement: &70263946971820 !ruby/object:Gem::Requirement
126
+ requirement: &70318308614080 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,7 +131,7 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70263946971820
134
+ version_requirements: *70318308614080
135
135
  description: Compile Haml CoffeeScript templates in the Rails asset pipeline.
136
136
  email:
137
137
  - michi@netzpiraten.ch