haml_coffee_assets 1.11.1 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 93f2ccc92329ca9b444dfee07f4e9a41dbd4ae6c
4
+ data.tar.gz: 801901d64e1274b52947117848a341821f715994
5
+ SHA512:
6
+ metadata.gz: 85cc9b88742800121bacf533bf23c3db55705300c53949af219045ab9ece3f682bd5619d6e009e47dd61ac64107173ca06dc09fe57c8706c9250b4b7c86079ad
7
+ data.tar.gz: 18445a4f5229d2ec3bc7827701d7d860da37526d01f7670a3e5b81c9b960d6cc7c3284f95014183120344b37b03415e997f464ce078319d86bca3e5cc0309fae
data/README.md CHANGED
@@ -5,7 +5,7 @@ pipeline, so you can use them as JavaScript templates in your JavaScript heavy R
5
5
  of templates is also possible, allowing you to share the same template files for Rails and JavaScript templates. It also
6
6
  works as a pure [Sprockets](https://github.com/sstephenson/sprockets) engine without Rails.
7
7
 
8
- Tested on MRI Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest version of JRuby.
8
+ Tested on MRI Ruby 1.9.2, 1.9.3, 2.0.0 and the latest version of JRuby.
9
9
 
10
10
  ## Features
11
11
 
@@ -76,7 +76,7 @@ module HamlCoffeeAssets
76
76
  partial_source(path),
77
77
  path,
78
78
  self.class,
79
- :virtual_path => partial_path(path)
79
+ virtual_path: partial_path(path)
80
80
  )
81
81
 
82
82
  compiled << self.class.new(
@@ -25,7 +25,7 @@ module HamlCoffeeAssets
25
25
  self.escapeAttributes = true
26
26
  self.cleanValue = true
27
27
  self.placement = 'global'
28
- self.dependencies = { :hc => 'hamlcoffee_amd' }
28
+ self.dependencies = { hc: 'hamlcoffee_amd' }
29
29
  self.customHtmlEscape = 'window.HAML.escape'
30
30
  self.customCleanValue = 'window.HAML.cleanValue'
31
31
  self.customPreserve = 'window.HAML.preserve'
@@ -14,7 +14,7 @@ module HamlCoffeeAssets
14
14
 
15
15
  # Initialize Haml Coffee Assets after Sprockets
16
16
  #
17
- initializer 'sprockets.hamlcoffeeassets', :group => :all, :after => 'sprockets.environment' do |app|
17
+ initializer 'sprockets.hamlcoffeeassets', group: :all, after: 'sprockets.environment' do |app|
18
18
  require 'haml_coffee_assets/action_view/template_handler'
19
19
 
20
20
  # No server side template support with AMD
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module HamlCoffeeAssets
4
- VERSION = '1.11.1' unless defined?(HamlCoffeeAssets::VERSION)
4
+ VERSION = '1.12.0' unless defined?(HamlCoffeeAssets::VERSION)
5
5
  end
@@ -41,6 +41,8 @@ var HamlCoffeeAssets = (function(){
41
41
  context, extendScope) {
42
42
 
43
43
  var compiler = new Compiler({
44
+ name: name,
45
+ namespace: namespace,
44
46
  format: format,
45
47
  uglify: uglify,
46
48
  basename: basename,
@@ -67,7 +69,7 @@ var HamlCoffeeAssets = (function(){
67
69
  var template;
68
70
 
69
71
  if (jst) {
70
- template = CoffeeScript.compile(compiler.render(name, namespace));
72
+ template = CoffeeScript.compile(compiler.render());
71
73
 
72
74
  } else {
73
75
  var hamlc = CoffeeScript.compile(compiler.precompile(), { bare: true });
data/lib/js/hamlcoffee.js CHANGED
@@ -4,13 +4,15 @@ var require = function (file, cwd) {
4
4
  if (!mod) throw new Error(
5
5
  'Failed to resolve module ' + file + ', tried ' + resolved
6
6
  );
7
- var res = mod._cached ? mod._cached : mod();
7
+ var cached = require.cache[resolved];
8
+ var res = cached? cached.exports : mod();
8
9
  return res;
9
- }
10
+ };
10
11
 
11
12
  require.paths = [];
12
13
  require.modules = {};
13
- require.extensions = [".js",".coffee"];
14
+ require.cache = {};
15
+ require.extensions = [".js",".coffee",".json"];
14
16
 
15
17
  require._core = {
16
18
  'assert': true,
@@ -41,6 +43,7 @@ require.resolve = (function () {
41
43
  throw new Error("Cannot find module '" + x + "'");
42
44
 
43
45
  function loadAsFileSync (x) {
46
+ x = path.normalize(x);
44
47
  if (require.modules[x]) {
45
48
  return x;
46
49
  }
@@ -53,7 +56,7 @@ require.resolve = (function () {
53
56
 
54
57
  function loadAsDirectorySync (x) {
55
58
  x = x.replace(/\/+$/, '');
56
- var pkgfile = x + '/package.json';
59
+ var pkgfile = path.normalize(x + '/package.json');
57
60
  if (require.modules[pkgfile]) {
58
61
  var pkg = require.modules[pkgfile]();
59
62
  var b = pkg.browserify;
@@ -118,7 +121,7 @@ require.alias = function (from, to) {
118
121
 
119
122
  var keys = (Object.keys || function (obj) {
120
123
  var res = [];
121
- for (var key in obj) res.push(key)
124
+ for (var key in obj) res.push(key);
122
125
  return res;
123
126
  })(require.modules);
124
127
 
@@ -134,77 +137,66 @@ require.alias = function (from, to) {
134
137
  }
135
138
  };
136
139
 
137
- require.define = function (filename, fn) {
138
- var dirname = require._core[filename]
139
- ? ''
140
- : require.modules.path().dirname(filename)
141
- ;
142
-
143
- var require_ = function (file) {
144
- return require(file, dirname)
145
- };
146
- require_.resolve = function (name) {
147
- return require.resolve(name, dirname);
148
- };
149
- require_.modules = require.modules;
150
- require_.define = require.define;
151
- var module_ = { exports : {} };
140
+ (function () {
141
+ var process = {};
142
+ var global = typeof window !== 'undefined' ? window : {};
143
+ var definedProcess = false;
152
144
 
153
- require.modules[filename] = function () {
154
- require.modules[filename]._cached = module_.exports;
155
- fn.call(
156
- module_.exports,
157
- require_,
158
- module_,
159
- module_.exports,
160
- dirname,
161
- filename
162
- );
163
- require.modules[filename]._cached = module_.exports;
164
- return module_.exports;
165
- };
166
- };
167
-
168
- if (typeof process === 'undefined') process = {};
145
+ require.define = function (filename, fn) {
146
+ if (!definedProcess && require.modules.__browserify_process) {
147
+ process = require.modules.__browserify_process();
148
+ definedProcess = true;
149
+ }
150
+
151
+ var dirname = require._core[filename]
152
+ ? ''
153
+ : require.modules.path().dirname(filename)
154
+ ;
155
+
156
+ var require_ = function (file) {
157
+ var requiredModule = require(file, dirname);
158
+ var cached = require.cache[require.resolve(file, dirname)];
169
159
 
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
- }
160
+ if (cached && cached.parent === null) {
161
+ cached.parent = module_;
184
162
  }
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);
163
+
164
+ return requiredModule;
165
+ };
166
+ require_.resolve = function (name) {
167
+ return require.resolve(name, dirname);
168
+ };
169
+ require_.modules = require.modules;
170
+ require_.define = require.define;
171
+ require_.cache = require.cache;
172
+ var module_ = {
173
+ id : filename,
174
+ filename: filename,
175
+ exports : {},
176
+ loaded : false,
177
+ parent: null
178
+ };
179
+
180
+ require.modules[filename] = function () {
181
+ require.cache[filename] = module_;
182
+ fn.call(
183
+ module_.exports,
184
+ require_,
185
+ module_,
186
+ module_.exports,
187
+ dirname,
188
+ filename,
189
+ process,
190
+ global
191
+ );
192
+ module_.loaded = true;
193
+ return module_.exports;
194
+ };
194
195
  };
195
196
  })();
196
197
 
197
- if (!process.title) process.title = 'browser';
198
198
 
199
- if (!process.binding) process.binding = function (name) {
200
- if (name === 'evals') return require('vm')
201
- else throw new Error('No such module')
202
- };
203
-
204
- if (!process.cwd) process.cwd = function () { return '.' };
205
-
206
- require.define("path", function (require, module, exports, __dirname, __filename) {
207
- function filter (xs, fn) {
199
+ require.define("path",function(require,module,exports,__dirname,__filename,process,global){function filter (xs, fn) {
208
200
  var res = [];
209
201
  for (var i = 0; i < xs.length; i++) {
210
202
  if (fn(xs[i], i, xs)) res.push(xs[i]);
@@ -339,11 +331,109 @@ exports.extname = function(path) {
339
331
  return splitPathRe.exec(path)[3] || '';
340
332
  };
341
333
 
334
+ exports.relative = function(from, to) {
335
+ from = exports.resolve(from).substr(1);
336
+ to = exports.resolve(to).substr(1);
337
+
338
+ function trim(arr) {
339
+ var start = 0;
340
+ for (; start < arr.length; start++) {
341
+ if (arr[start] !== '') break;
342
+ }
343
+
344
+ var end = arr.length - 1;
345
+ for (; end >= 0; end--) {
346
+ if (arr[end] !== '') break;
347
+ }
348
+
349
+ if (start > end) return [];
350
+ return arr.slice(start, end - start + 1);
351
+ }
352
+
353
+ var fromParts = trim(from.split('/'));
354
+ var toParts = trim(to.split('/'));
355
+
356
+ var length = Math.min(fromParts.length, toParts.length);
357
+ var samePartsLength = length;
358
+ for (var i = 0; i < length; i++) {
359
+ if (fromParts[i] !== toParts[i]) {
360
+ samePartsLength = i;
361
+ break;
362
+ }
363
+ }
364
+
365
+ var outputParts = [];
366
+ for (var i = samePartsLength; i < fromParts.length; i++) {
367
+ outputParts.push('..');
368
+ }
369
+
370
+ outputParts = outputParts.concat(toParts.slice(samePartsLength));
371
+
372
+ return outputParts.join('/');
373
+ };
374
+
375
+ });
376
+
377
+ require.define("__browserify_process",function(require,module,exports,__dirname,__filename,process,global){var process = module.exports = {};
378
+
379
+ process.nextTick = (function () {
380
+ var canSetImmediate = typeof window !== 'undefined'
381
+ && window.setImmediate;
382
+ var canPost = typeof window !== 'undefined'
383
+ && window.postMessage && window.addEventListener
384
+ ;
385
+
386
+ if (canSetImmediate) {
387
+ return function (f) { return window.setImmediate(f) };
388
+ }
389
+
390
+ if (canPost) {
391
+ var queue = [];
392
+ window.addEventListener('message', function (ev) {
393
+ if (ev.source === window && ev.data === 'browserify-tick') {
394
+ ev.stopPropagation();
395
+ if (queue.length > 0) {
396
+ var fn = queue.shift();
397
+ fn();
398
+ }
399
+ }
400
+ }, true);
401
+
402
+ return function nextTick(fn) {
403
+ queue.push(fn);
404
+ window.postMessage('browserify-tick', '*');
405
+ };
406
+ }
407
+
408
+ return function nextTick(fn) {
409
+ setTimeout(fn, 0);
410
+ };
411
+ })();
412
+
413
+ process.title = 'browser';
414
+ process.browser = true;
415
+ process.env = {};
416
+ process.argv = [];
417
+
418
+ process.binding = function (name) {
419
+ if (name === 'evals') return (require)('vm')
420
+ else throw new Error('No such module. (Possibly not yet loaded)')
421
+ };
422
+
423
+ (function () {
424
+ var cwd = '/';
425
+ var path;
426
+ process.cwd = function () { return cwd };
427
+ process.chdir = function (dir) {
428
+ if (!path) path = require('path');
429
+ cwd = path.resolve(dir, cwd);
430
+ };
431
+ })();
432
+
342
433
  });
343
434
 
344
- require.define("/haml-coffee.coffee", function (require, module, exports, __dirname, __filename) {
345
- (function() {
346
- var Code, Comment, Filter, Haml, HamlCoffee, Node, Text, indent, whitespace;
435
+ require.define("/haml-coffee.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
436
+ var Code, Comment, Directive, Filter, Haml, HamlCoffee, Node, Text, indent, whitespace;
347
437
 
348
438
  Node = require('./nodes/node');
349
439
 
@@ -357,43 +447,50 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
357
447
 
358
448
  Filter = require('./nodes/filter');
359
449
 
450
+ Directive = require('./nodes/directive');
451
+
360
452
  whitespace = require('./util/text').whitespace;
361
453
 
362
454
  indent = require('./util/text').indent;
363
455
 
364
456
  module.exports = HamlCoffee = (function() {
365
-
366
- HamlCoffee.VERSION = '1.9.1';
457
+ HamlCoffee.VERSION = '1.11.0';
367
458
 
368
459
  function HamlCoffee(options) {
369
- var _base, _base10, _base11, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _base9, _ref, _ref10, _ref11, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
460
+ var segment, segments, _base, _base1, _base10, _base11, _base12, _base13, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _base9, _i, _len, _ref, _ref1, _ref10, _ref11, _ref12, _ref13, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
461
+
370
462
  this.options = options != null ? options : {};
371
463
  if ((_ref = (_base = this.options).placement) == null) {
372
464
  _base.placement = 'global';
373
465
  }
374
- if ((_ref2 = (_base2 = this.options).dependencies) == null) {
375
- _base2.dependencies = {
466
+ if ((_ref1 = (_base1 = this.options).dependencies) == null) {
467
+ _base1.dependencies = {
376
468
  hc: 'hamlcoffee'
377
469
  };
378
470
  }
379
- if ((_ref3 = (_base3 = this.options).escapeHtml) == null) {
380
- _base3.escapeHtml = true;
471
+ if ((_ref2 = (_base2 = this.options).escapeHtml) == null) {
472
+ _base2.escapeHtml = true;
381
473
  }
382
- if ((_ref4 = (_base4 = this.options).escapeAttributes) == null) {
383
- _base4.escapeAttributes = true;
474
+ if ((_ref3 = (_base3 = this.options).escapeAttributes) == null) {
475
+ _base3.escapeAttributes = true;
384
476
  }
385
- if ((_ref5 = (_base5 = this.options).cleanValue) == null) {
386
- _base5.cleanValue = true;
477
+ if ((_ref4 = (_base4 = this.options).cleanValue) == null) {
478
+ _base4.cleanValue = true;
387
479
  }
388
- if ((_ref6 = (_base6 = this.options).uglify) == null) _base6.uglify = false;
389
- if ((_ref7 = (_base7 = this.options).basename) == null) {
390
- _base7.basename = false;
480
+ if ((_ref5 = (_base5 = this.options).uglify) == null) {
481
+ _base5.uglify = false;
391
482
  }
392
- if ((_ref8 = (_base8 = this.options).extendScope) == null) {
393
- _base8.extendScope = false;
483
+ if ((_ref6 = (_base6 = this.options).basename) == null) {
484
+ _base6.basename = false;
394
485
  }
395
- if ((_ref9 = (_base9 = this.options).format) == null) {
396
- _base9.format = 'html5';
486
+ if ((_ref7 = (_base7 = this.options).extendScope) == null) {
487
+ _base7.extendScope = false;
488
+ }
489
+ if ((_ref8 = (_base8 = this.options).format) == null) {
490
+ _base8.format = 'html5';
491
+ }
492
+ if ((_ref9 = (_base9 = this.options).hyphenateDataAttrs) == null) {
493
+ _base9.hyphenateDataAttrs = true;
397
494
  }
398
495
  if ((_ref10 = (_base10 = this.options).preserveTags) == null) {
399
496
  _base10.preserveTags = 'pre,textarea';
@@ -401,6 +498,27 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
401
498
  if ((_ref11 = (_base11 = this.options).selfCloseTags) == null) {
402
499
  _base11.selfCloseTags = 'meta,img,link,br,hr,input,area,param,col,base';
403
500
  }
501
+ if (this.options.placement === 'global') {
502
+ if ((_ref12 = (_base12 = this.options).name) == null) {
503
+ _base12.name = 'test';
504
+ }
505
+ if ((_ref13 = (_base13 = this.options).namespace) == null) {
506
+ _base13.namespace = 'window.HAML';
507
+ }
508
+ segments = ("" + this.options.namespace + "." + this.options.name).replace(/(\s|-)+/g, '_').split(/\./);
509
+ this.options.name = this.options.basename ? segments.pop().split(/\/|\\/).pop() : segments.pop();
510
+ this.options.namespace = segments.shift();
511
+ this.intro = '';
512
+ if (segments.length !== 0) {
513
+ for (_i = 0, _len = segments.length; _i < _len; _i++) {
514
+ segment = segments[_i];
515
+ this.options.namespace += "." + segment;
516
+ this.intro += "" + this.options.namespace + " ?= {}\n";
517
+ }
518
+ } else {
519
+ this.intro += "" + this.options.namespace + " ?= {}\n";
520
+ }
521
+ }
404
522
  }
405
523
 
406
524
  HamlCoffee.prototype.indentChanged = function() {
@@ -452,16 +570,19 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
452
570
  };
453
571
 
454
572
  HamlCoffee.prototype.popParent = function() {
455
- var i, _ref, _results;
573
+ var i, _i, _ref, _results;
574
+
456
575
  _results = [];
457
- for (i = 0, _ref = this.delta - 1; 0 <= _ref ? i <= _ref : i >= _ref; 0 <= _ref ? i++ : i--) {
576
+ for (i = _i = 0, _ref = this.delta - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
458
577
  _results.push(this.parentNode = this.stack.pop());
459
578
  }
460
579
  return _results;
461
580
  };
462
581
 
463
582
  HamlCoffee.prototype.getNodeOptions = function(override) {
464
- if (override == null) override = {};
583
+ if (override == null) {
584
+ override = {};
585
+ }
465
586
  return {
466
587
  parentNode: override.parentNode || this.parentNode,
467
588
  blockLevel: override.blockLevel || this.currentBlockLevel,
@@ -470,15 +591,22 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
470
591
  escapeAttributes: override.escapeAttributes || this.options.escapeAttributes,
471
592
  cleanValue: override.cleanValue || this.options.cleanValue,
472
593
  format: override.format || this.options.format,
594
+ hyphenateDataAttrs: override.hyphenateDataAttrs || this.options.format,
473
595
  preserveTags: override.preserveTags || this.options.preserveTags,
474
596
  selfCloseTags: override.selfCloseTags || this.options.selfCloseTags,
475
- uglify: override.uglify || this.options.uglify
597
+ uglify: override.uglify || this.options.uglify,
598
+ placement: override.placement || this.options.placement,
599
+ namespace: override.namespace || this.options.namespace,
600
+ name: override.name || this.options.name
476
601
  };
477
602
  };
478
603
 
479
604
  HamlCoffee.prototype.nodeFactory = function(expression) {
480
605
  var node, options, _ref;
481
- if (expression == null) expression = '';
606
+
607
+ if (expression == null) {
608
+ expression = '';
609
+ }
482
610
  options = this.getNodeOptions();
483
611
  if (expression.match(/^:(escaped|preserve|css|javascript|plain|cdata|coffeescript)/)) {
484
612
  node = new Filter(expression, options);
@@ -488,16 +616,23 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
488
616
  node = new Code(expression, options);
489
617
  } else if (expression.match(/^(%|#[^{]|\.|\!)(.*)/)) {
490
618
  node = new Haml(expression, options);
619
+ } else if (expression.match(/^\+(.*)/)) {
620
+ node = new Directive(expression, options);
491
621
  } else {
492
622
  node = new Text(expression, options);
493
623
  }
494
- if ((_ref = options.parentNode) != null) _ref.addChild(node);
624
+ if ((_ref = options.parentNode) != null) {
625
+ _ref.addChild(node);
626
+ }
495
627
  return node;
496
628
  };
497
629
 
498
630
  HamlCoffee.prototype.parse = function(source) {
499
631
  var attributes, expression, line, lines, result, text, ws, _ref;
500
- if (source == null) source = '';
632
+
633
+ if (source == null) {
634
+ source = '';
635
+ }
501
636
  this.lineNumber = this.previousIndent = this.tabSize = this.currentBlockLevel = this.previousBlockLevel = 0;
502
637
  this.currentCodeBlockLevel = this.previousCodeBlockLevel = 0;
503
638
  this.node = null;
@@ -531,7 +666,9 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
531
666
  result = line.match(/^(\s*)(.*)/);
532
667
  ws = result[1];
533
668
  expression = result[2];
534
- if (/^\s*$/.test(line)) continue;
669
+ if (/^\s*$/.test(line)) {
670
+ continue;
671
+ }
535
672
  while (/^[%.#].*[{(]/.test(expression) && !/^(\s*)[-=&!~.%#</]/.test(lines[0]) && /([-\w]+[\w:-]*\w?)\s*=|('\w+[\w:-]*\w?')\s*=|("\w+[\w:-]*\w?")\s*=|(\w+[\w:-]*\w?):|('[-\w]+[\w:-]*\w?'):|("[-\w]+[\w:-]*\w?"):|:(\w+[\w:-]*\w?)\s*=>|:?'([-\w]+[\w:-]*\w?)'\s*=>|:?"([-\w]+[\w:-]*\w?)"\s*=>/.test(lines[0])) {
536
673
  attributes = lines.shift();
537
674
  expression = expression.replace(/(\s)+\|\s*$/, '');
@@ -563,6 +700,7 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
563
700
 
564
701
  HamlCoffee.prototype.evaluate = function(node) {
565
702
  var child, _i, _len, _ref;
703
+
566
704
  _ref = node.children;
567
705
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
568
706
  child = _ref[_i];
@@ -571,18 +709,26 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
571
709
  return node.evaluate();
572
710
  };
573
711
 
574
- HamlCoffee.prototype.render = function(templateName, namespace) {
575
- if (namespace == null) namespace = 'window.HAML';
712
+ HamlCoffee.prototype.render = function() {
576
713
  switch (this.options.placement) {
577
714
  case 'amd':
578
715
  return this.renderAmd();
716
+ case 'standalone':
717
+ return this.renderStandalone();
579
718
  default:
580
- return this.renderGlobal(templateName, namespace);
719
+ return this.renderGlobal();
581
720
  }
582
721
  };
583
722
 
723
+ HamlCoffee.prototype.renderStandalone = function() {
724
+ var template;
725
+
726
+ return template = "return (context) ->\n (->\n" + (indent(this.precompile(), 2)) + "\n ).call(context)";
727
+ };
728
+
584
729
  HamlCoffee.prototype.renderAmd = function() {
585
- var m, module, modules, param, params, template, _ref, _ref2;
730
+ var m, module, modules, param, params, template, _ref, _ref1;
731
+
586
732
  if (/^hamlcoffee/.test(this.options.dependencies['hc'])) {
587
733
  this.options.customHtmlEscape = 'hc.escape';
588
734
  this.options.customCleanValue = 'hc.cleanValue';
@@ -602,15 +748,16 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
602
748
  params.push(param);
603
749
  }
604
750
  template = indent(this.precompile(), 4);
605
- _ref2 = this.findDependencies(template);
606
- for (param in _ref2) {
607
- module = _ref2[param];
751
+ _ref1 = this.findDependencies(template);
752
+ for (param in _ref1) {
753
+ module = _ref1[param];
608
754
  modules.push(module);
609
755
  params.push(param);
610
756
  }
611
757
  if (modules.length !== 0) {
612
758
  modules = (function() {
613
759
  var _i, _len, _results;
760
+
614
761
  _results = [];
615
762
  for (_i = 0, _len = modules.length; _i < _len; _i++) {
616
763
  m = modules[_i];
@@ -625,30 +772,18 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
625
772
  return "define " + modules + " ->\n (context) ->\n render = ->\n \n" + template + "\n render.call(context)";
626
773
  };
627
774
 
628
- HamlCoffee.prototype.renderGlobal = function(templateName, namespace) {
629
- var segment, segments, template, _i, _len;
630
- if (namespace == null) namespace = 'window.HAML';
631
- template = '';
632
- segments = ("" + namespace + "." + templateName).replace(/(\s|-)+/g, '_').split(/\./);
633
- templateName = this.options.basename ? segments.pop().split(/\/|\\/).pop() : segments.pop();
634
- namespace = segments.shift();
635
- if (segments.length !== 0) {
636
- for (_i = 0, _len = segments.length; _i < _len; _i++) {
637
- segment = segments[_i];
638
- namespace += "." + segment;
639
- template += "" + namespace + " ?= {}\n";
640
- }
641
- } else {
642
- template += "" + namespace + " ?= {}\n";
643
- }
775
+ HamlCoffee.prototype.renderGlobal = function() {
776
+ var template;
777
+
778
+ template = this.intro;
644
779
  if (this.options.extendScope) {
645
- template += "" + namespace + "['" + templateName + "'] = (context) -> ( ->\n";
780
+ template += "" + this.options.namespace + "['" + this.options.name + "'] = (context) -> ( ->\n";
646
781
  template += " `with (context || {}) {`\n";
647
782
  template += "" + (indent(this.precompile(), 1));
648
783
  template += "`}`\n";
649
784
  template += ").call(context)";
650
785
  } else {
651
- template += "" + namespace + "['" + templateName + "'] = (context) -> ( ->\n";
786
+ template += "" + this.options.namespace + "['" + this.options.name + "'] = (context) -> ( ->\n";
652
787
  template += "" + (indent(this.precompile(), 1));
653
788
  template += ").call(context)";
654
789
  }
@@ -657,6 +792,7 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
657
792
 
658
793
  HamlCoffee.prototype.precompile = function() {
659
794
  var code, fn;
795
+
660
796
  fn = '';
661
797
  code = this.createCode();
662
798
  if (code.indexOf('$e') !== -1) {
@@ -725,7 +861,8 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
725
861
  };
726
862
 
727
863
  HamlCoffee.prototype.createCode = function() {
728
- var child, code, line, processors, _i, _j, _len, _len2, _ref, _ref2;
864
+ var child, code, line, processors, _i, _j, _len, _len1, _ref, _ref1;
865
+
729
866
  code = [];
730
867
  this.lines = [];
731
868
  _ref = this.root.children;
@@ -735,9 +872,9 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
735
872
  }
736
873
  this.lines = this.combineText(this.lines);
737
874
  this.blockLevel = 0;
738
- _ref2 = this.lines;
739
- for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
740
- line = _ref2[_j];
875
+ _ref1 = this.lines;
876
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
877
+ line = _ref1[_j];
741
878
  if (line !== null) {
742
879
  switch (line.type) {
743
880
  case 'text':
@@ -753,10 +890,18 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
753
890
  break;
754
891
  case 'insert':
755
892
  processors = '';
756
- if (line.findAndPreserve) processors += '$fp ';
757
- if (line.preserve) processors += '$p ';
758
- if (line.escape) processors += '$e ';
759
- if (this.options.cleanValue) processors += '$c ';
893
+ if (line.findAndPreserve) {
894
+ processors += '$fp ';
895
+ }
896
+ if (line.preserve) {
897
+ processors += '$p ';
898
+ }
899
+ if (line.escape) {
900
+ processors += '$e ';
901
+ }
902
+ if (this.options.cleanValue) {
903
+ processors += '$c ';
904
+ }
760
905
  code.push("" + (whitespace(line.cw)) + (this.getBuffer(this.blockLevel)) + ".push \"" + (whitespace(line.hw)) + "\" + " + processors + line.code);
761
906
  if (line.block === 'start') {
762
907
  this.blockLevel += 1;
@@ -778,6 +923,7 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
778
923
 
779
924
  HamlCoffee.prototype.combineText = function(lines) {
780
925
  var combined, line, nextLine;
926
+
781
927
  combined = [];
782
928
  while ((line = lines.shift()) !== void 0) {
783
929
  if (line.type === 'text') {
@@ -821,6 +967,7 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
821
967
 
822
968
  HamlCoffee.prototype.findDependencies = function(code) {
823
969
  var dependencies, match, module, name, requireRegexp;
970
+
824
971
  requireRegexp = /require(?:\s+|\()(['"])(.+?)(\1)\)?/gm;
825
972
  dependencies = {};
826
973
  while (match = requireRegexp.exec(code)) {
@@ -839,21 +986,21 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
839
986
 
840
987
  });
841
988
 
842
- require.define("/nodes/node.coffee", function (require, module, exports, __dirname, __filename) {
843
- (function() {
989
+ require.define("/nodes/node.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
844
990
  var Node, escapeHTML;
845
991
 
846
992
  escapeHTML = require('../util/text').escapeHTML;
847
993
 
848
994
  module.exports = Node = (function() {
849
-
850
995
  Node.CLEAR_WHITESPACE_LEFT = '\u0091';
851
996
 
852
997
  Node.CLEAR_WHITESPACE_RIGHT = '\u0092';
853
998
 
854
999
  function Node(expression, options) {
855
1000
  this.expression = expression != null ? expression : '';
856
- if (options == null) options = {};
1001
+ if (options == null) {
1002
+ options = {};
1003
+ }
857
1004
  this.parentNode = options.parentNode;
858
1005
  this.children = [];
859
1006
  this.opener = this.closer = null;
@@ -868,10 +1015,14 @@ require.define("/nodes/node.coffee", function (require, module, exports, __dirna
868
1015
  this.escapeAttributes = options.escapeAttributes;
869
1016
  this.cleanValue = options.cleanValue;
870
1017
  this.format = options.format;
1018
+ this.hyphenateDataAttrs = options.hyphenateDataAttrs;
871
1019
  this.selfCloseTags = options.selfCloseTags.split(',');
872
1020
  this.uglify = options.uglify;
873
1021
  this.codeBlockLevel = options.codeBlockLevel;
874
1022
  this.blockLevel = options.blockLevel;
1023
+ this.placement = options.placement;
1024
+ this.namespace = options.namespace;
1025
+ this.name = options.name;
875
1026
  }
876
1027
 
877
1028
  Node.prototype.addChild = function(child) {
@@ -900,7 +1051,9 @@ require.define("/nodes/node.coffee", function (require, module, exports, __dirna
900
1051
  };
901
1052
 
902
1053
  Node.prototype.isPreserved = function() {
903
- if (this.preserve) return true;
1054
+ if (this.preserve) {
1055
+ return true;
1056
+ }
904
1057
  if (this.parentNode) {
905
1058
  return this.parentNode.isPreserved();
906
1059
  } else {
@@ -909,7 +1062,9 @@ require.define("/nodes/node.coffee", function (require, module, exports, __dirna
909
1062
  };
910
1063
 
911
1064
  Node.prototype.isCommented = function() {
912
- if (this.constructor.name === 'Comment') return true;
1065
+ if (this.constructor.name === 'Comment') {
1066
+ return true;
1067
+ }
913
1068
  if (this.parentNode) {
914
1069
  return this.parentNode.isCommented();
915
1070
  } else {
@@ -918,7 +1073,9 @@ require.define("/nodes/node.coffee", function (require, module, exports, __dirna
918
1073
  };
919
1074
 
920
1075
  Node.prototype.markText = function(text, escape) {
921
- if (escape == null) escape = false;
1076
+ if (escape == null) {
1077
+ escape = false;
1078
+ }
922
1079
  return {
923
1080
  type: 'text',
924
1081
  cw: this.codeBlockLevel,
@@ -936,9 +1093,15 @@ require.define("/nodes/node.coffee", function (require, module, exports, __dirna
936
1093
  };
937
1094
 
938
1095
  Node.prototype.markInsertingCode = function(code, escape, preserve, findAndPreserve) {
939
- if (escape == null) escape = false;
940
- if (preserve == null) preserve = false;
941
- if (findAndPreserve == null) findAndPreserve = false;
1096
+ if (escape == null) {
1097
+ escape = false;
1098
+ }
1099
+ if (preserve == null) {
1100
+ preserve = false;
1101
+ }
1102
+ if (findAndPreserve == null) {
1103
+ findAndPreserve = false;
1104
+ }
942
1105
  return {
943
1106
  type: 'insert',
944
1107
  cw: this.codeBlockLevel,
@@ -953,9 +1116,12 @@ require.define("/nodes/node.coffee", function (require, module, exports, __dirna
953
1116
  Node.prototype.evaluate = function() {};
954
1117
 
955
1118
  Node.prototype.render = function() {
956
- var child, output, rendered, tag, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _m, _ref, _ref2, _ref3, _ref4, _ref5;
1119
+ var child, output, rendered, tag, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4;
1120
+
957
1121
  output = [];
958
- if (this.silent) return output;
1122
+ if (this.silent) {
1123
+ return output;
1124
+ }
959
1125
  if (this.children.length === 0) {
960
1126
  if (this.opener && this.closer) {
961
1127
  tag = this.getOpener();
@@ -976,9 +1142,9 @@ require.define("/nodes/node.coffee", function (require, module, exports, __dirna
976
1142
  _ref = this.children;
977
1143
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
978
1144
  child = _ref[_i];
979
- _ref2 = child.render();
980
- for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
981
- rendered = _ref2[_j];
1145
+ _ref1 = child.render();
1146
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
1147
+ rendered = _ref1[_j];
982
1148
  rendered.hw = this.blockLevel;
983
1149
  output.push(rendered);
984
1150
  }
@@ -986,24 +1152,24 @@ require.define("/nodes/node.coffee", function (require, module, exports, __dirna
986
1152
  output.push(this.getCloser());
987
1153
  } else {
988
1154
  output.push(this.getOpener());
989
- _ref3 = this.children;
990
- for (_k = 0, _len3 = _ref3.length; _k < _len3; _k++) {
991
- child = _ref3[_k];
1155
+ _ref2 = this.children;
1156
+ for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1157
+ child = _ref2[_k];
992
1158
  output = output.concat(child.render());
993
1159
  }
994
1160
  output.push(this.getCloser());
995
1161
  }
996
1162
  } else if (this.opener) {
997
1163
  output.push(this.getOpener());
998
- _ref4 = this.children;
999
- for (_l = 0, _len4 = _ref4.length; _l < _len4; _l++) {
1000
- child = _ref4[_l];
1164
+ _ref3 = this.children;
1165
+ for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1166
+ child = _ref3[_l];
1001
1167
  output = output.concat(child.render());
1002
1168
  }
1003
1169
  } else {
1004
- _ref5 = this.children;
1005
- for (_m = 0, _len5 = _ref5.length; _m < _len5; _m++) {
1006
- child = _ref5[_m];
1170
+ _ref4 = this.children;
1171
+ for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
1172
+ child = _ref4[_m];
1007
1173
  output.push(this.markText(child.render().text));
1008
1174
  }
1009
1175
  }
@@ -1019,11 +1185,11 @@ require.define("/nodes/node.coffee", function (require, module, exports, __dirna
1019
1185
 
1020
1186
  });
1021
1187
 
1022
- require.define("/util/text.coffee", function (require, module, exports, __dirname, __filename) {
1023
-
1188
+ require.define("/util/text.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
1024
1189
  module.exports = {
1025
1190
  whitespace: function(n) {
1026
1191
  var a;
1192
+
1027
1193
  n = n * 2;
1028
1194
  a = [];
1029
1195
  while (a.length < n) {
@@ -1032,15 +1198,21 @@ require.define("/util/text.coffee", function (require, module, exports, __dirnam
1032
1198
  return a.join('');
1033
1199
  },
1034
1200
  escapeQuotes: function(text) {
1035
- if (!text) return '';
1201
+ if (!text) {
1202
+ return '';
1203
+ }
1036
1204
  return text.replace(/"/g, '\\"').replace(/\\\\\"/g, '\\"');
1037
1205
  },
1038
1206
  unescapeQuotes: function(text) {
1039
- if (!text) return '';
1207
+ if (!text) {
1208
+ return '';
1209
+ }
1040
1210
  return text.replace(/\\"/g, '"');
1041
1211
  },
1042
1212
  escapeHTML: function(text) {
1043
- if (!text) return '';
1213
+ if (!text) {
1214
+ return '';
1215
+ }
1044
1216
  return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');
1045
1217
  },
1046
1218
  preserve: function(code) {
@@ -1055,23 +1227,25 @@ require.define("/util/text.coffee", function (require, module, exports, __dirnam
1055
1227
  }
1056
1228
  };
1057
1229
 
1230
+ }).call(this);
1231
+
1058
1232
  });
1059
1233
 
1060
- require.define("/nodes/text.coffee", function (require, module, exports, __dirname, __filename) {
1061
- (function() {
1062
- var Node, Text, escapeQuotes;
1063
- var __hasProp = Object.prototype.hasOwnProperty, __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; };
1234
+ require.define("/nodes/text.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
1235
+ var Node, Text, escapeQuotes, _ref,
1236
+ __hasProp = {}.hasOwnProperty,
1237
+ __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; };
1064
1238
 
1065
1239
  Node = require('./node');
1066
1240
 
1067
1241
  escapeQuotes = require('../util/text').escapeQuotes;
1068
1242
 
1069
- module.exports = Text = (function() {
1070
-
1071
- __extends(Text, Node);
1243
+ module.exports = Text = (function(_super) {
1244
+ __extends(Text, _super);
1072
1245
 
1073
1246
  function Text() {
1074
- Text.__super__.constructor.apply(this, arguments);
1247
+ _ref = Text.__super__.constructor.apply(this, arguments);
1248
+ return _ref;
1075
1249
  }
1076
1250
 
1077
1251
  Text.prototype.evaluate = function() {
@@ -1080,31 +1254,32 @@ require.define("/nodes/text.coffee", function (require, module, exports, __dirna
1080
1254
 
1081
1255
  return Text;
1082
1256
 
1083
- })();
1257
+ })(Node);
1084
1258
 
1085
1259
  }).call(this);
1086
1260
 
1087
1261
  });
1088
1262
 
1089
- require.define("/nodes/haml.coffee", function (require, module, exports, __dirname, __filename) {
1090
- (function() {
1091
- var Haml, Node, escapeQuotes;
1092
- var __hasProp = Object.prototype.hasOwnProperty, __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; };
1263
+ require.define("/nodes/haml.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
1264
+ var Haml, Node, escapeQuotes, _ref,
1265
+ __hasProp = {}.hasOwnProperty,
1266
+ __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; };
1093
1267
 
1094
1268
  Node = require('./node');
1095
1269
 
1096
1270
  escapeQuotes = require('../util/text').escapeQuotes;
1097
1271
 
1098
- module.exports = Haml = (function() {
1099
-
1100
- __extends(Haml, Node);
1272
+ module.exports = Haml = (function(_super) {
1273
+ __extends(Haml, _super);
1101
1274
 
1102
1275
  function Haml() {
1103
- Haml.__super__.constructor.apply(this, arguments);
1276
+ _ref = Haml.__super__.constructor.apply(this, arguments);
1277
+ return _ref;
1104
1278
  }
1105
1279
 
1106
1280
  Haml.prototype.evaluate = function() {
1107
1281
  var assignment, code, identifier, match, prefix, tokens;
1282
+
1108
1283
  tokens = this.parseExpression(this.expression);
1109
1284
  if (tokens.doctype) {
1110
1285
  return this.opener = this.markText("" + (escapeQuotes(this.buildDocType(tokens.doctype))));
@@ -1164,10 +1339,13 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1164
1339
  };
1165
1340
 
1166
1341
  Haml.prototype.parseExpression = function(exp) {
1167
- var attributes, classes, id, key, tag, value, _ref, _ref2;
1342
+ var attributes, classes, id, key, tag, value, _ref1, _ref2;
1343
+
1168
1344
  tag = this.parseTag(exp);
1169
- if (this.preserveTags.indexOf(tag.tag) !== -1) this.preserve = true;
1170
- id = this.interpolateCodeAttribute((_ref = tag.ids) != null ? _ref.pop() : void 0, true);
1345
+ if (this.preserveTags.indexOf(tag.tag) !== -1) {
1346
+ this.preserve = true;
1347
+ }
1348
+ id = this.interpolateCodeAttribute((_ref1 = tag.ids) != null ? _ref1.pop() : void 0, true);
1171
1349
  classes = tag.classes;
1172
1350
  attributes = {};
1173
1351
  if (tag.attributes) {
@@ -1201,9 +1379,10 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1201
1379
  };
1202
1380
 
1203
1381
  Haml.prototype.parseTag = function(exp) {
1204
- var assignment, attr, attributes, ch, classes, doctype, end, haml, htmlAttributes, id, ids, key, klass, level, pos, reference, rest, rubyAttributes, start, tag, text, val, whitespace, _i, _j, _len, _len2, _ref, _ref2, _ref3, _ref4, _ref5;
1382
+ var assignment, attr, attributes, ch, classes, doctype, end, error, haml, htmlAttributes, id, ids, key, klass, level, pos, reference, rest, rubyAttributes, start, tag, text, val, whitespace, _i, _j, _k, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5;
1383
+
1205
1384
  try {
1206
- doctype = (_ref = exp.match(/^(\!{3}.*)/)) != null ? _ref[1] : void 0;
1385
+ doctype = (_ref1 = exp.match(/^(\!{3}.*)/)) != null ? _ref1[1] : void 0;
1207
1386
  if (doctype) {
1208
1387
  return {
1209
1388
  doctype: doctype
@@ -1230,9 +1409,11 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1230
1409
  }
1231
1410
  })();
1232
1411
  level = 0;
1233
- for (pos = 0, _ref3 = rest.length; 0 <= _ref3 ? pos <= _ref3 : pos >= _ref3; 0 <= _ref3 ? pos++ : pos--) {
1412
+ for (pos = _j = 0, _ref3 = rest.length; 0 <= _ref3 ? _j <= _ref3 : _j >= _ref3; pos = 0 <= _ref3 ? ++_j : --_j) {
1234
1413
  ch = rest[pos];
1235
- if (ch === start) level += 1;
1414
+ if (ch === start) {
1415
+ level += 1;
1416
+ }
1236
1417
  if (ch === end) {
1237
1418
  if (level === 1) {
1238
1419
  break;
@@ -1265,8 +1446,8 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1265
1446
  }
1266
1447
  attributes = {};
1267
1448
  _ref4 = [this.parseAttributes(htmlAttributes), this.parseAttributes(rubyAttributes)];
1268
- for (_j = 0, _len2 = _ref4.length; _j < _len2; _j++) {
1269
- attr = _ref4[_j];
1449
+ for (_k = 0, _len1 = _ref4.length; _k < _len1; _k++) {
1450
+ attr = _ref4[_k];
1270
1451
  for (key in attr) {
1271
1452
  val = attr[key];
1272
1453
  attributes[key] = val;
@@ -1275,13 +1456,17 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1275
1456
  if (whitespace = (_ref5 = assignment.match(/^[<>]{0,2}/)) != null ? _ref5[0] : void 0) {
1276
1457
  assignment = assignment.substring(whitespace.length);
1277
1458
  }
1278
- if (assignment[0] === ' ') assignment = assignment.substring(1);
1459
+ if (assignment[0] === ' ') {
1460
+ assignment = assignment.substring(1);
1461
+ }
1279
1462
  if (assignment && !assignment.match(/^(=|!=|&=|~)/)) {
1280
1463
  text = assignment.replace(/^ /, '');
1281
1464
  assignment = void 0;
1282
1465
  }
1283
1466
  if (whitespace) {
1284
- if (whitespace.indexOf('>') !== -1) this.wsRemoval.around = true;
1467
+ if (whitespace.indexOf('>') !== -1) {
1468
+ this.wsRemoval.around = true;
1469
+ }
1285
1470
  if (whitespace.indexOf('<') !== -1) {
1286
1471
  this.wsRemoval.inside = true;
1287
1472
  this.preserve = true;
@@ -1293,19 +1478,21 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1293
1478
  return {
1294
1479
  tag: tag ? tag[1] : 'div',
1295
1480
  ids: ids ? (function() {
1296
- var _k, _len3, _results;
1481
+ var _l, _len2, _results;
1482
+
1297
1483
  _results = [];
1298
- for (_k = 0, _len3 = ids.length; _k < _len3; _k++) {
1299
- id = ids[_k];
1484
+ for (_l = 0, _len2 = ids.length; _l < _len2; _l++) {
1485
+ id = ids[_l];
1300
1486
  _results.push("'" + (id.substr(1)) + "'");
1301
1487
  }
1302
1488
  return _results;
1303
1489
  })() : void 0,
1304
1490
  classes: classes ? (function() {
1305
- var _k, _len3, _results;
1491
+ var _l, _len2, _results;
1492
+
1306
1493
  _results = [];
1307
- for (_k = 0, _len3 = classes.length; _k < _len3; _k++) {
1308
- klass = classes[_k];
1494
+ for (_l = 0, _len2 = classes.length; _l < _len2; _l++) {
1495
+ klass = classes[_l];
1309
1496
  _results.push("'" + (klass.substr(1)) + "'");
1310
1497
  }
1311
1498
  return _results;
@@ -1315,15 +1502,19 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1315
1502
  reference: reference,
1316
1503
  text: text
1317
1504
  };
1318
- } catch (error) {
1319
- throw "Unable to parse tag from " + exp + ": " + error;
1505
+ } catch (_error) {
1506
+ error = _error;
1507
+ throw new Error("Unable to parse tag from " + exp + ": " + error);
1320
1508
  }
1321
1509
  };
1322
1510
 
1323
1511
  Haml.prototype.parseAttributes = function(exp) {
1324
- var attributes, ch, endPos, hasDataAttribute, inDataAttribute, key, keyValue, keys, level, marker, markers, pairs, pos, quoted, start, startPos, type, value, _i, _len, _ref, _ref2, _ref3;
1512
+ var attr, attributes, ch, endPos, hasDataAttribute, inDataAttribute, key, keyValue, keys, level, marker, markers, pairs, pos, quote, quoted, start, startPos, type, value, _i, _j, _k, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5;
1513
+
1325
1514
  attributes = {};
1326
- if (exp === void 0) return attributes;
1515
+ if (exp === void 0) {
1516
+ return attributes;
1517
+ }
1327
1518
  type = exp.substring(0, 1);
1328
1519
  exp = exp.replace(/(=|:|=>)\s*('([^\\']|\\\\|\\')*'|"([^\\"]|\\\\|\\")*")/g, function(match, type, value) {
1329
1520
  return type + (value != null ? value.replace(/(:|=|=>)/g, '\u0090$1') : void 0);
@@ -1338,11 +1529,13 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1338
1529
  startPos = 0;
1339
1530
  endPos = exp.length;
1340
1531
  }
1341
- for (pos = startPos; startPos <= endPos ? pos < endPos : pos > endPos; startPos <= endPos ? pos++ : pos--) {
1532
+ for (pos = _i = startPos; startPos <= endPos ? _i < endPos : _i > endPos; pos = startPos <= endPos ? ++_i : --_i) {
1342
1533
  ch = exp[pos];
1343
1534
  if (ch === '(') {
1344
1535
  level += 1;
1345
- if (level === 1) start = pos;
1536
+ if (level === 1) {
1537
+ start = pos;
1538
+ }
1346
1539
  }
1347
1540
  if (ch === ')') {
1348
1541
  if (level === 1) {
@@ -1357,9 +1550,9 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1357
1550
  }
1358
1551
  }
1359
1552
  }
1360
- _ref = markers.reverse();
1361
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1362
- marker = _ref[_i];
1553
+ _ref1 = markers.reverse();
1554
+ for (_j = 0, _len = _ref1.length; _j < _len; _j++) {
1555
+ marker = _ref1[_j];
1363
1556
  exp = exp.substring(0, marker.start) + exp.substring(marker.start, marker.end).replace(/(:|=|=>)/g, '\u0090$1') + exp.substring(marker.end);
1364
1557
  }
1365
1558
  switch (type) {
@@ -1374,43 +1567,71 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1374
1567
  hasDataAttribute = false;
1375
1568
  while (pairs.length) {
1376
1569
  keyValue = pairs.splice(0, 2);
1377
- key = (_ref2 = keyValue[0]) != null ? _ref2.replace(/^\s+|\s+$/g, '').replace(/^:/, '') : void 0;
1378
- if (quoted = key.match(/^("|')(.*)\1$/)) key = quoted[2];
1379
- value = (_ref3 = keyValue[1]) != null ? _ref3.replace(/^\s+|[\s,]+$/g, '').replace(/\u0090/g, '') : void 0;
1380
- if (key === 'data' && !value) {
1381
- inDataAttribute = true;
1382
- hasDataAttribute = true;
1383
- } else if (key && value) {
1384
- if (inDataAttribute) {
1385
- key = "data-" + key;
1386
- if (/}\s*$/.test(value)) inDataAttribute = false;
1570
+ if (keyValue.length === 1) {
1571
+ attr = keyValue[0].replace(/^[\s({]+|[\s)}]+$/g, '');
1572
+ attributes[attr] = 'true';
1573
+ } else {
1574
+ key = (_ref2 = keyValue[0]) != null ? _ref2.replace(/^\s+|\s+$/g, '').replace(/^:/, '') : void 0;
1575
+ if (quoted = key.match(/^("|')(.*)\1$/)) {
1576
+ key = quoted[2];
1577
+ }
1578
+ value = (_ref3 = keyValue[1]) != null ? _ref3.replace(/^\s+|[\s,]+$/g, '').replace(/\u0090/g, '') : void 0;
1579
+ if (key === 'data' && !value) {
1580
+ inDataAttribute = true;
1581
+ hasDataAttribute = true;
1582
+ } else if (key && value) {
1583
+ if (inDataAttribute) {
1584
+ key = this.hyphenateDataAttrs ? "data-" + (key.replace('_', '-')) : "data-" + key;
1585
+ if (/}\s*$/.test(value)) {
1586
+ inDataAttribute = false;
1587
+ }
1588
+ }
1589
+ }
1590
+ switch (type) {
1591
+ case '(':
1592
+ value = value.replace(/^\s+|[\s)]+$/g, '');
1593
+ quote = (_ref4 = /^(['"])/.exec(value)) != null ? _ref4[1] : void 0;
1594
+ pos = value.lastIndexOf(quote);
1595
+ if (pos > 1) {
1596
+ _ref5 = value.substring(pos + 1).split(' ');
1597
+ for (_k = 0, _len1 = _ref5.length; _k < _len1; _k++) {
1598
+ attr = _ref5[_k];
1599
+ if (attr) {
1600
+ attributes[attr] = 'true';
1601
+ }
1602
+ }
1603
+ value = value.substring(0, pos + 1);
1604
+ }
1605
+ attributes[key] = value;
1606
+ break;
1607
+ case '{':
1608
+ attributes[key] = value.replace(/^\s+|[\s}]+$/g, '');
1387
1609
  }
1388
1610
  }
1389
- switch (type) {
1390
- case '(':
1391
- attributes[key] = value.replace(/^\s+|[\s)]+$/g, '');
1392
- break;
1393
- case '{':
1394
- attributes[key] = value.replace(/^\s+|[\s}]+$/g, '');
1395
- }
1396
1611
  }
1397
- if (hasDataAttribute) delete attributes['data'];
1612
+ if (hasDataAttribute) {
1613
+ delete attributes['data'];
1614
+ }
1398
1615
  return attributes;
1399
1616
  };
1400
1617
 
1401
1618
  Haml.prototype.buildHtmlTagPrefix = function(tokens) {
1402
- var classList, classes, hasDynamicClass, key, klass, name, tagParts, value, _i, _len, _ref;
1619
+ var classList, classes, hasDynamicClass, key, klass, name, tagParts, value, _i, _len, _ref1;
1620
+
1403
1621
  tagParts = ["<" + tokens.tag];
1404
1622
  if (tokens.classes) {
1405
1623
  hasDynamicClass = false;
1406
1624
  classList = (function() {
1407
- var _i, _len, _ref, _results;
1408
- _ref = tokens.classes;
1625
+ var _i, _len, _ref1, _results;
1626
+
1627
+ _ref1 = tokens.classes;
1409
1628
  _results = [];
1410
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1411
- name = _ref[_i];
1629
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
1630
+ name = _ref1[_i];
1412
1631
  name = this.interpolateCodeAttribute(name, true);
1413
- if (name.indexOf('#{') !== -1) hasDynamicClass = true;
1632
+ if (name.indexOf('#{') !== -1) {
1633
+ hasDynamicClass = true;
1634
+ }
1414
1635
  _results.push(name);
1415
1636
  }
1416
1637
  return _results;
@@ -1427,7 +1648,9 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1427
1648
  }
1428
1649
  tagParts.push("class='" + classes + "'");
1429
1650
  }
1430
- if (tokens.id) tagParts.push("id='" + tokens.id + "'");
1651
+ if (tokens.id) {
1652
+ tagParts.push("id='" + tokens.id + "'");
1653
+ }
1431
1654
  if (tokens.reference) {
1432
1655
  if (tokens.attributes) {
1433
1656
  delete tokens.attributes['class'];
@@ -1436,9 +1659,9 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1436
1659
  tagParts.push("\#{$r(" + tokens.reference + ")}");
1437
1660
  }
1438
1661
  if (tokens.attributes) {
1439
- _ref = tokens.attributes;
1440
- for (key in _ref) {
1441
- value = _ref[key];
1662
+ _ref1 = tokens.attributes;
1663
+ for (key in _ref1) {
1664
+ value = _ref1[key];
1442
1665
  if (value === 'true' || value === 'false') {
1443
1666
  if (value === 'true') {
1444
1667
  if (this.format === 'html5') {
@@ -1457,8 +1680,13 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1457
1680
 
1458
1681
  Haml.prototype.interpolateCodeAttribute = function(text, unwrap) {
1459
1682
  var quoted;
1460
- if (unwrap == null) unwrap = false;
1461
- if (!text) return;
1683
+
1684
+ if (unwrap == null) {
1685
+ unwrap = false;
1686
+ }
1687
+ if (!text) {
1688
+ return;
1689
+ }
1462
1690
  if (!text.match(/^("|').*\1$/)) {
1463
1691
  if (this.escapeAttributes) {
1464
1692
  if (this.cleanValue) {
@@ -1474,21 +1702,33 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1474
1702
  }
1475
1703
  }
1476
1704
  }
1477
- if (unwrap) if (quoted = text.match(/^("|')(.*)\1$/)) text = quoted[2];
1705
+ if (unwrap) {
1706
+ if (quoted = text.match(/^("|')(.*)\1$/)) {
1707
+ text = quoted[2];
1708
+ }
1709
+ }
1478
1710
  return text;
1479
1711
  };
1480
1712
 
1481
1713
  Haml.prototype.quoteAndEscapeAttributeValue = function(value, code) {
1482
1714
  var escaped, hasDoubleQuotes, hasInterpolation, hasSingleQuotes, quoted, result, token, tokens;
1483
- if (code == null) code = false;
1484
- if (!value) return;
1485
- if (quoted = value.match(/^("|')(.*)\1$/)) value = quoted[2];
1715
+
1716
+ if (code == null) {
1717
+ code = false;
1718
+ }
1719
+ if (!value) {
1720
+ return;
1721
+ }
1722
+ if (quoted = value.match(/^("|')(.*)\1$/)) {
1723
+ value = quoted[2];
1724
+ }
1486
1725
  tokens = this.splitInterpolations(value);
1487
1726
  hasSingleQuotes = false;
1488
1727
  hasDoubleQuotes = false;
1489
1728
  hasInterpolation = false;
1490
1729
  tokens = (function() {
1491
1730
  var _i, _len, _results;
1731
+
1492
1732
  _results = [];
1493
1733
  for (_i = 0, _len = tokens.length; _i < _len; _i++) {
1494
1734
  token = tokens[_i];
@@ -1501,13 +1741,19 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1501
1741
  token = '#{ $e(' + token.slice(2, -1) + ') }';
1502
1742
  }
1503
1743
  } else {
1504
- if (this.cleanValue) token = '#{ $c(' + token.slice(2, -1) + ') }';
1744
+ if (this.cleanValue) {
1745
+ token = '#{ $c(' + token.slice(2, -1) + ') }';
1746
+ }
1505
1747
  }
1506
1748
  }
1507
1749
  hasInterpolation = true;
1508
1750
  } else {
1509
- if (!hasSingleQuotes) hasSingleQuotes = token.indexOf("'") !== -1;
1510
- if (!hasDoubleQuotes) hasDoubleQuotes = token.indexOf('"') !== -1;
1751
+ if (!hasSingleQuotes) {
1752
+ hasSingleQuotes = token.indexOf("'") !== -1;
1753
+ }
1754
+ if (!hasDoubleQuotes) {
1755
+ hasDoubleQuotes = token.indexOf('"') !== -1;
1756
+ }
1511
1757
  }
1512
1758
  _results.push(token);
1513
1759
  }
@@ -1529,6 +1775,7 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1529
1775
  if (hasDoubleQuotes && !hasSingleQuotes) {
1530
1776
  escaped = (function() {
1531
1777
  var _i, _len, _results;
1778
+
1532
1779
  _results = [];
1533
1780
  for (_i = 0, _len = tokens.length; _i < _len; _i++) {
1534
1781
  token = tokens[_i];
@@ -1541,6 +1788,7 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1541
1788
  if (hasSingleQuotes && hasDoubleQuotes) {
1542
1789
  escaped = (function() {
1543
1790
  var _i, _len, _results;
1791
+
1544
1792
  _results = [];
1545
1793
  for (_i = 0, _len = tokens.length; _i < _len; _i++) {
1546
1794
  token = tokens[_i];
@@ -1555,14 +1803,17 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1555
1803
  };
1556
1804
 
1557
1805
  Haml.prototype.splitInterpolations = function(value) {
1558
- var ch, ch2, level, pos, start, tokens, _ref;
1806
+ var ch, ch2, level, pos, start, tokens, _i, _ref1;
1807
+
1559
1808
  level = 0;
1560
1809
  start = 0;
1561
1810
  tokens = [];
1562
- for (pos = 0, _ref = value.length; 0 <= _ref ? pos < _ref : pos > _ref; 0 <= _ref ? pos++ : pos--) {
1811
+ for (pos = _i = 0, _ref1 = value.length; 0 <= _ref1 ? _i < _ref1 : _i > _ref1; pos = 0 <= _ref1 ? ++_i : --_i) {
1563
1812
  ch = value[pos];
1564
- ch2 = value.slice(pos, (pos + 1) + 1 || 9e9);
1565
- if (ch === '{') level += 1;
1813
+ ch2 = value.slice(pos, +(pos + 1) + 1 || 9e9);
1814
+ if (ch === '{') {
1815
+ level += 1;
1816
+ }
1566
1817
  if (ch2 === '#{' && level === 0) {
1567
1818
  tokens.push(value.slice(start, pos));
1568
1819
  start = pos;
@@ -1570,7 +1821,7 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1570
1821
  if (ch === '}') {
1571
1822
  level -= 1;
1572
1823
  if (level === 0) {
1573
- tokens.push(value.slice(start, pos + 1 || 9e9));
1824
+ tokens.push(value.slice(start, +pos + 1 || 9e9));
1574
1825
  start = pos + 1;
1575
1826
  }
1576
1827
  }
@@ -1614,29 +1865,30 @@ require.define("/nodes/haml.coffee", function (require, module, exports, __dirna
1614
1865
 
1615
1866
  return Haml;
1616
1867
 
1617
- })();
1868
+ })(Node);
1618
1869
 
1619
1870
  }).call(this);
1620
1871
 
1621
1872
  });
1622
1873
 
1623
- require.define("/nodes/code.coffee", function (require, module, exports, __dirname, __filename) {
1624
- (function() {
1625
- var Code, Node;
1626
- var __hasProp = Object.prototype.hasOwnProperty, __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; };
1874
+ require.define("/nodes/code.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
1875
+ var Code, Node, _ref,
1876
+ __hasProp = {}.hasOwnProperty,
1877
+ __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; };
1627
1878
 
1628
1879
  Node = require('./node');
1629
1880
 
1630
- module.exports = Code = (function() {
1631
-
1632
- __extends(Code, Node);
1881
+ module.exports = Code = (function(_super) {
1882
+ __extends(Code, _super);
1633
1883
 
1634
1884
  function Code() {
1635
- Code.__super__.constructor.apply(this, arguments);
1885
+ _ref = Code.__super__.constructor.apply(this, arguments);
1886
+ return _ref;
1636
1887
  }
1637
1888
 
1638
1889
  Code.prototype.evaluate = function() {
1639
1890
  var code, codeBlock, escape, identifier;
1891
+
1640
1892
  codeBlock = this.expression.match(/(-|!=|\&=|=|~)\s?(.*)?/);
1641
1893
  identifier = codeBlock[1];
1642
1894
  code = codeBlock[2];
@@ -1666,32 +1918,33 @@ require.define("/nodes/code.coffee", function (require, module, exports, __dirna
1666
1918
 
1667
1919
  return Code;
1668
1920
 
1669
- })();
1921
+ })(Node);
1670
1922
 
1671
1923
  }).call(this);
1672
1924
 
1673
1925
  });
1674
1926
 
1675
- require.define("/nodes/comment.coffee", function (require, module, exports, __dirname, __filename) {
1676
- (function() {
1677
- var Comment, Node, escapeQuotes;
1678
- var __hasProp = Object.prototype.hasOwnProperty, __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; };
1927
+ require.define("/nodes/comment.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
1928
+ var Comment, Node, escapeQuotes, _ref,
1929
+ __hasProp = {}.hasOwnProperty,
1930
+ __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; };
1679
1931
 
1680
1932
  Node = require('./node');
1681
1933
 
1682
1934
  escapeQuotes = require('../util/text').escapeQuotes;
1683
1935
 
1684
- module.exports = Comment = (function() {
1685
-
1686
- __extends(Comment, Node);
1936
+ module.exports = Comment = (function(_super) {
1937
+ __extends(Comment, _super);
1687
1938
 
1688
1939
  function Comment() {
1689
- Comment.__super__.constructor.apply(this, arguments);
1940
+ _ref = Comment.__super__.constructor.apply(this, arguments);
1941
+ return _ref;
1690
1942
  }
1691
1943
 
1692
1944
  Comment.prototype.evaluate = function() {
1693
- var comment, expression, identifier, _ref;
1694
- _ref = this.expression.match(/(-#|\/\[|\/)\s?(.*)?/), expression = _ref[0], identifier = _ref[1], comment = _ref[2];
1945
+ var comment, expression, identifier, _ref1;
1946
+
1947
+ _ref1 = this.expression.match(/(-#|\/\[|\/)\s?(.*)?/), expression = _ref1[0], identifier = _ref1[1], comment = _ref1[2];
1695
1948
  switch (identifier) {
1696
1949
  case '-#':
1697
1950
  this.silent = true;
@@ -1712,16 +1965,16 @@ require.define("/nodes/comment.coffee", function (require, module, exports, __di
1712
1965
 
1713
1966
  return Comment;
1714
1967
 
1715
- })();
1968
+ })(Node);
1716
1969
 
1717
1970
  }).call(this);
1718
1971
 
1719
1972
  });
1720
1973
 
1721
- require.define("/nodes/filter.coffee", function (require, module, exports, __dirname, __filename) {
1722
- (function() {
1723
- var Filter, Node, unescapeQuotes, whitespace;
1724
- var __hasProp = Object.prototype.hasOwnProperty, __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; };
1974
+ require.define("/nodes/filter.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
1975
+ var Filter, Node, unescapeQuotes, whitespace, _ref,
1976
+ __hasProp = {}.hasOwnProperty,
1977
+ __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; };
1725
1978
 
1726
1979
  Node = require('./node');
1727
1980
 
@@ -1729,34 +1982,36 @@ require.define("/nodes/filter.coffee", function (require, module, exports, __dir
1729
1982
 
1730
1983
  unescapeQuotes = require('../util/text').unescapeQuotes;
1731
1984
 
1732
- module.exports = Filter = (function() {
1733
-
1734
- __extends(Filter, Node);
1985
+ module.exports = Filter = (function(_super) {
1986
+ __extends(Filter, _super);
1735
1987
 
1736
1988
  function Filter() {
1737
- Filter.__super__.constructor.apply(this, arguments);
1989
+ _ref = Filter.__super__.constructor.apply(this, arguments);
1990
+ return _ref;
1738
1991
  }
1739
1992
 
1740
1993
  Filter.prototype.evaluate = function() {
1741
- var _ref;
1742
- return this.filter = (_ref = this.expression.match(/:(escaped|preserve|css|javascript|coffeescript|plain|cdata|coffeescript)(.*)?/)) != null ? _ref[1] : void 0;
1994
+ var _ref1;
1995
+
1996
+ return this.filter = (_ref1 = this.expression.match(/:(escaped|preserve|css|javascript|coffeescript|plain|cdata|coffeescript)(.*)?/)) != null ? _ref1[1] : void 0;
1743
1997
  };
1744
1998
 
1745
1999
  Filter.prototype.render = function() {
1746
- var child, indent, output, preserve, _i, _j, _len, _len2, _ref, _ref2;
2000
+ var child, indent, output, preserve, _i, _j, _len, _len1, _ref1, _ref2;
2001
+
1747
2002
  output = [];
1748
2003
  switch (this.filter) {
1749
2004
  case 'escaped':
1750
- _ref = this.children;
1751
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1752
- child = _ref[_i];
2005
+ _ref1 = this.children;
2006
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
2007
+ child = _ref1[_i];
1753
2008
  output.push(this.markText(child.render()[0].text, true));
1754
2009
  }
1755
2010
  break;
1756
2011
  case 'preserve':
1757
2012
  preserve = '';
1758
2013
  _ref2 = this.children;
1759
- for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
2014
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
1760
2015
  child = _ref2[_j];
1761
2016
  preserve += "" + (child.render()[0].text) + "&#x000A;";
1762
2017
  }
@@ -1777,7 +2032,9 @@ require.define("/nodes/filter.coffee", function (require, module, exports, __dir
1777
2032
  }
1778
2033
  indent = this.format === 'xhtml' ? 2 : 1;
1779
2034
  this.renderFilterContent(indent, output);
1780
- if (this.format === 'xhtml') output.push(this.markText(' /*]]>*/'));
2035
+ if (this.format === 'xhtml') {
2036
+ output.push(this.markText(' /*]]>*/'));
2037
+ }
1781
2038
  output.push(this.markText('</style>'));
1782
2039
  break;
1783
2040
  case 'javascript':
@@ -1786,10 +2043,14 @@ require.define("/nodes/filter.coffee", function (require, module, exports, __dir
1786
2043
  } else {
1787
2044
  output.push(this.markText('<script type=\'text/javascript\'>'));
1788
2045
  }
1789
- if (this.format === 'xhtml') output.push(this.markText(' //<![CDATA['));
2046
+ if (this.format === 'xhtml') {
2047
+ output.push(this.markText(' //<![CDATA['));
2048
+ }
1790
2049
  indent = this.format === 'xhtml' ? 2 : 1;
1791
2050
  this.renderFilterContent(indent, output);
1792
- if (this.format === 'xhtml') output.push(this.markText(' //]]>'));
2051
+ if (this.format === 'xhtml') {
2052
+ output.push(this.markText(' //]]>'));
2053
+ }
1793
2054
  output.push(this.markText('</script>'));
1794
2055
  break;
1795
2056
  case 'cdata':
@@ -1804,24 +2065,27 @@ require.define("/nodes/filter.coffee", function (require, module, exports, __dir
1804
2065
  };
1805
2066
 
1806
2067
  Filter.prototype.renderFilterContent = function(indent, output, type) {
1807
- var child, content, e, empty, line, _i, _j, _len, _len2, _ref, _results;
1808
- if (type == null) type = 'text';
2068
+ var child, content, e, empty, line, _i, _j, _k, _len, _len1, _ref1, _results;
2069
+
2070
+ if (type == null) {
2071
+ type = 'text';
2072
+ }
1809
2073
  content = [];
1810
2074
  empty = 0;
1811
- _ref = this.children;
1812
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1813
- child = _ref[_i];
2075
+ _ref1 = this.children;
2076
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
2077
+ child = _ref1[_i];
1814
2078
  content.push(child.render()[0].text);
1815
2079
  }
1816
2080
  _results = [];
1817
- for (_j = 0, _len2 = content.length; _j < _len2; _j++) {
2081
+ for (_j = 0, _len1 = content.length; _j < _len1; _j++) {
1818
2082
  line = content[_j];
1819
2083
  if (line === '') {
1820
2084
  _results.push(empty += 1);
1821
2085
  } else {
1822
2086
  switch (type) {
1823
2087
  case 'text':
1824
- for (e = 0; 0 <= empty ? e < empty : e > empty; 0 <= empty ? e++ : e--) {
2088
+ for (e = _k = 0; 0 <= empty ? _k < empty : _k > empty; e = 0 <= empty ? ++_k : --_k) {
1825
2089
  output.push(this.markText(""));
1826
2090
  }
1827
2091
  output.push(this.markText("" + (whitespace(indent)) + line));
@@ -1837,14 +2101,78 @@ require.define("/nodes/filter.coffee", function (require, module, exports, __dir
1837
2101
 
1838
2102
  return Filter;
1839
2103
 
1840
- })();
2104
+ })(Node);
1841
2105
 
1842
2106
  }).call(this);
1843
2107
 
1844
2108
  });
1845
2109
 
1846
- require.define("/hamlc.coffee", function (require, module, exports, __dirname, __filename) {
1847
- (function() {
2110
+ require.define("/nodes/directive.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
2111
+ var Directive, Node, path, _ref,
2112
+ __hasProp = {}.hasOwnProperty,
2113
+ __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; };
2114
+
2115
+ path = require('path');
2116
+
2117
+ Node = require('./node');
2118
+
2119
+ module.exports = Directive = (function(_super) {
2120
+ __extends(Directive, _super);
2121
+
2122
+ function Directive() {
2123
+ _ref = Directive.__super__.constructor.apply(this, arguments);
2124
+ return _ref;
2125
+ }
2126
+
2127
+ Directive.prototype.directives = {
2128
+ include: function(expression) {
2129
+ var context, e, name, statement, _ref1;
2130
+
2131
+ try {
2132
+ _ref1 = expression.match(/\s*['"](.*)['"](?:,\s*(.*))?\s*/), _ref1[0], name = _ref1[1], context = _ref1[2];
2133
+ } catch (_error) {
2134
+ e = _error;
2135
+ throw new Error("Failed to parse the include directive from " + expression);
2136
+ }
2137
+ if (!context) {
2138
+ context = 'this';
2139
+ }
2140
+ statement = (function() {
2141
+ switch (this.placement) {
2142
+ case 'global':
2143
+ return "" + this.namespace + "['" + name + "'].apply(" + context + ")";
2144
+ case 'amd':
2145
+ return "require('" + name + "').apply(" + context + ")";
2146
+ default:
2147
+ throw new Error("Include directive not available when placement is " + this.placement);
2148
+ }
2149
+ }).call(this);
2150
+ return this.opener = this.markInsertingCode(statement, false);
2151
+ }
2152
+ };
2153
+
2154
+ Directive.prototype.evaluate = function() {
2155
+ var directives, e, name, rest, _ref1;
2156
+
2157
+ directives = Object.keys(this.directives).join('|');
2158
+ try {
2159
+ _ref1 = this.expression.match(RegExp("\\+(" + directives + ")(.*)")), _ref1[0], name = _ref1[1], rest = _ref1[2];
2160
+ } catch (_error) {
2161
+ e = _error;
2162
+ throw new Error("Unable to recognize directive from " + this.expression);
2163
+ }
2164
+ return this.directives[name].call(this, rest);
2165
+ };
2166
+
2167
+ return Directive;
2168
+
2169
+ })(Node);
2170
+
2171
+ }).call(this);
2172
+
2173
+ });
2174
+
2175
+ require.define("/hamlc.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
1848
2176
  var CoffeeScript, Compiler, fs, __expressCache;
1849
2177
 
1850
2178
  fs = require('fs');
@@ -1862,7 +2190,10 @@ require.define("/hamlc.coffee", function (require, module, exports, __dirname, _
1862
2190
  module.exports = {
1863
2191
  compile: function(source, options) {
1864
2192
  var compiler, template;
1865
- if (options == null) options = {};
2193
+
2194
+ if (options == null) {
2195
+ options = {};
2196
+ }
1866
2197
  compiler = new Compiler(options);
1867
2198
  compiler.parse(source);
1868
2199
  template = new Function(CoffeeScript.compile(compiler.precompile(), {
@@ -1874,13 +2205,19 @@ require.define("/hamlc.coffee", function (require, module, exports, __dirname, _
1874
2205
  },
1875
2206
  template: function(source, name, namespace, options) {
1876
2207
  var compiler;
1877
- if (options == null) options = {};
2208
+
2209
+ if (options == null) {
2210
+ options = {};
2211
+ }
2212
+ options.namespace = namespace;
2213
+ options.name = name;
1878
2214
  compiler = new Compiler(options);
1879
2215
  compiler.parse(source);
1880
- return CoffeeScript.compile(compiler.render(name, namespace));
2216
+ return CoffeeScript.compile(compiler.render());
1881
2217
  },
1882
2218
  __express: function(filename, options, callback) {
1883
- var source;
2219
+ var err, source;
2220
+
1884
2221
  if (!!(options && options.constructor && options.call && options.apply)) {
1885
2222
  callback = options;
1886
2223
  options = {};
@@ -1898,7 +2235,8 @@ require.define("/hamlc.coffee", function (require, module, exports, __dirname, _
1898
2235
  return callback(null, module.exports.compile(source, options)(options));
1899
2236
  }
1900
2237
  }
1901
- } catch (err) {
2238
+ } catch (_error) {
2239
+ err = _error;
1902
2240
  return callback(err);
1903
2241
  }
1904
2242
  }
@@ -1908,7 +2246,6 @@ require.define("/hamlc.coffee", function (require, module, exports, __dirname, _
1908
2246
 
1909
2247
  });
1910
2248
 
1911
- require.define("fs", function (require, module, exports, __dirname, __filename) {
1912
- // nothing to see here... no file methods for the browser
2249
+ require.define("fs",function(require,module,exports,__dirname,__filename,process,global){// nothing to see here... no file methods for the browser
1913
2250
 
1914
2251
  });