haml_coffee_assets 1.4.9 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module HamlCoffeeAssets
4
- VERSION = '1.4.9' unless defined?(HamlCoffeeAssets::VERSION)
4
+ VERSION = '1.5.1' unless defined?(HamlCoffeeAssets::VERSION)
5
5
  end
data/lib/js/hamlcoffee.js CHANGED
@@ -363,7 +363,7 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
363
363
 
364
364
  module.exports = HamlCoffee = (function() {
365
365
 
366
- HamlCoffee.VERSION = '1.4.9';
366
+ HamlCoffee.VERSION = '1.5.1';
367
367
 
368
368
  function HamlCoffee(options) {
369
369
  var _base, _base2, _base3, _base4, _base5, _base6, _base7, _base8, _base9, _ref, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
@@ -631,28 +631,28 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
631
631
  }
632
632
  if (code.indexOf('surround') !== -1) {
633
633
  if (this.options.customSurround) {
634
- fn += "surround = (start, end, fn) -> " + this.options.customSurround + ".call(context, start, end, fn)\n";
634
+ fn += "surround = (start, end, fn) => " + this.options.customSurround + ".call(@, start, end, fn)\n";
635
635
  } else {
636
- fn += "surround = (start, end, fn) -> start + fn.call(context)?.replace(/^\s+|\s+$/g, '') + end\n";
636
+ fn += "surround = (start, end, fn) => start + fn.call(@)?.replace(/^\s+|\s+$/g, '') + end\n";
637
637
  }
638
638
  }
639
639
  if (code.indexOf('succeed') !== -1) {
640
640
  if (this.options.customSucceed) {
641
- fn += "succeed = (start, end, fn) -> " + this.options.customSucceed + ".call(context, start, end, fn)\n";
641
+ fn += "succeed = (start, end, fn) => " + this.options.customSucceed + ".call(@, start, end, fn)\n";
642
642
  } else {
643
- fn += "succeed = (end, fn) -> fn.call(context)?.replace(/\s+$/g, '') + end\n";
643
+ fn += "succeed = (end, fn) => fn.call(@)?.replace(/\s+$/g, '') + end\n";
644
644
  }
645
645
  }
646
646
  if (code.indexOf('precede') !== -1) {
647
647
  if (this.options.customPrecede) {
648
- fn += "precede = (start, end, fn) -> " + this.options.customPrecede + ".call(context, start, end, fn)\n";
648
+ fn += "precede = (start, end, fn) => " + this.options.customPrecede + ".call(@, start, end, fn)\n";
649
649
  } else {
650
- fn += "precede = (start, fn) -> start + fn.call(context)?.replace(/^\s+/g, '')\n";
650
+ fn += "precede = (start, fn) => start + fn.call(@)?.replace(/^\s+/g, '')\n";
651
651
  }
652
652
  }
653
653
  fn += "$o = []\n";
654
654
  fn += "" + code + "\n";
655
- return fn += "return $o.join(\"\\n\")" + (this.convertBooleans(code)) + (this.cleanupWhitespace(code)) + "\n";
655
+ return fn += "return $o.join(\"\\n\")" + (this.convertBooleans(code)) + (this.removeEmptyIDAndClass(code)) + (this.cleanupWhitespace(code)) + "\n";
656
656
  };
657
657
 
658
658
  HamlCoffee.prototype.createCode = function() {
@@ -734,6 +734,14 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
734
734
  }
735
735
  };
736
736
 
737
+ HamlCoffee.prototype.removeEmptyIDAndClass = function(code) {
738
+ if (code.indexOf('id=') !== -1 || code.indexOf('class=') !== -1) {
739
+ return '.replace(/\\s(?:id|class)=([\'"])(\\1)/mg, "")';
740
+ } else {
741
+ return '';
742
+ }
743
+ };
744
+
737
745
  HamlCoffee.prototype.cleanupWhitespace = function(code) {
738
746
  if (/\u0091|\u0092/.test(code)) {
739
747
  return ".replace(/[\\s\\n]*\\u0091/mg, '').replace(/\\u0092[\\s\\n]*/mg, '')";
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: 1.4.9
4
+ version: 1.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-14 00:00:00.000000000 Z
12
+ date: 2012-09-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coffee-script
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: 1221451205017024980
111
+ hash: 591423817109157098
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements: