Permalink
Browse files

Release 1.5.1

  • Loading branch information...
1 parent 2b18103 commit 395ff9e05c0b422867438f9f9e1879a1c9212c03 @netzpirat netzpirat committed Sep 24, 2012
Showing with 41 additions and 23 deletions.
  1. +4 −0 CHANGELOG.md
  2. +1 −1 lib/haml_coffee_assets/version.rb
  3. +16 −8 lib/js/hamlcoffee.js
  4. +20 −14 spec/haml_coffee_assets/compiler_spec.rb
View
@@ -6,6 +6,10 @@ belongs to.
Please also have a look at the [Haml Coffee Changelog](https://github.com/netzpirat/haml-coffee/blob/master/CHANGELOG.md).
+## 1.5.1 - September 24, 2012
+
+- Upgrade to Haml Coffee 1.5.1
+
## 1.4.9 - September 14, 2012
- [#69][]: Timing issue during configuration
@@ -1,5 +1,5 @@
# coding: UTF-8
module HamlCoffeeAssets
- VERSION = '1.4.9' unless defined?(HamlCoffeeAssets::VERSION)
+ VERSION = '1.5.1' unless defined?(HamlCoffeeAssets::VERSION)
end
View
@@ -363,7 +363,7 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
module.exports = HamlCoffee = (function() {
- HamlCoffee.VERSION = '1.4.9';
+ HamlCoffee.VERSION = '1.5.1';
function HamlCoffee(options) {
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
}
if (code.indexOf('surround') !== -1) {
if (this.options.customSurround) {
- fn += "surround = (start, end, fn) -> " + this.options.customSurround + ".call(context, start, end, fn)\n";
+ fn += "surround = (start, end, fn) => " + this.options.customSurround + ".call(@, start, end, fn)\n";
} else {
- fn += "surround = (start, end, fn) -> start + fn.call(context)?.replace(/^\s+|\s+$/g, '') + end\n";
+ fn += "surround = (start, end, fn) => start + fn.call(@)?.replace(/^\s+|\s+$/g, '') + end\n";
}
}
if (code.indexOf('succeed') !== -1) {
if (this.options.customSucceed) {
- fn += "succeed = (start, end, fn) -> " + this.options.customSucceed + ".call(context, start, end, fn)\n";
+ fn += "succeed = (start, end, fn) => " + this.options.customSucceed + ".call(@, start, end, fn)\n";
} else {
- fn += "succeed = (end, fn) -> fn.call(context)?.replace(/\s+$/g, '') + end\n";
+ fn += "succeed = (end, fn) => fn.call(@)?.replace(/\s+$/g, '') + end\n";
}
}
if (code.indexOf('precede') !== -1) {
if (this.options.customPrecede) {
- fn += "precede = (start, end, fn) -> " + this.options.customPrecede + ".call(context, start, end, fn)\n";
+ fn += "precede = (start, end, fn) => " + this.options.customPrecede + ".call(@, start, end, fn)\n";
} else {
- fn += "precede = (start, fn) -> start + fn.call(context)?.replace(/^\s+/g, '')\n";
+ fn += "precede = (start, fn) => start + fn.call(@)?.replace(/^\s+/g, '')\n";
}
}
fn += "$o = []\n";
fn += "" + code + "\n";
- return fn += "return $o.join(\"\\n\")" + (this.convertBooleans(code)) + (this.cleanupWhitespace(code)) + "\n";
+ return fn += "return $o.join(\"\\n\")" + (this.convertBooleans(code)) + (this.removeEmptyIDAndClass(code)) + (this.cleanupWhitespace(code)) + "\n";
};
HamlCoffee.prototype.createCode = function() {
@@ -734,6 +734,14 @@ require.define("/haml-coffee.coffee", function (require, module, exports, __dirn
}
};
+ HamlCoffee.prototype.removeEmptyIDAndClass = function(code) {
+ if (code.indexOf('id=') !== -1 || code.indexOf('class=') !== -1) {
+ return '.replace(/\\s(?:id|class)=([\'"])(\\1)/mg, "")';
+ } else {
+ return '';
+ }
+ };
+
HamlCoffee.prototype.cleanupWhitespace = function(code) {
if (/\u0091|\u0092/.test(code)) {
return ".replace(/[\\s\\n]*\\u0091/mg, '').replace(/\\u0092[\\s\\n]*/mg, '')";
@@ -782,11 +782,12 @@
window.JST['surround'] = function(context) {
return (function() {
- var $c, $e, $o, surround;
+ var $c, $e, $o, surround,
+ _this = this;
$e = window.HAML.escape;
$c = window.HAML.cleanValue;
surround = function(start, end, fn) {
- return window.HAML.surround.call(context, start, end, fn);
+ return window.HAML.surround.call(_this, start, end, fn);
};
$o = [];
$o.push("" + $e($c(surround('(', ')', function() {
@@ -815,11 +816,12 @@
window.JST['surround'] = function(context) {
return (function() {
- var $c, $e, $o, surround;
+ var $c, $e, $o, surround,
+ _this = this;
$e = window.HAML.escape;
$c = window.HAML.cleanValue;
surround = function(start, end, fn) {
- return SomeWhere.surround.call(context, start, end, fn);
+ return SomeWhere.surround.call(_this, start, end, fn);
};
$o = [];
$o.push("" + $e($c(surround('(', ')', function() {
@@ -849,11 +851,12 @@
window.JST['succeed'] = function(context) {
return (function() {
- var $c, $e, $o, succeed;
+ var $c, $e, $o, succeed,
+ _this = this;
$e = window.HAML.escape;
$c = window.HAML.cleanValue;
succeed = function(start, end, fn) {
- return window.HAML.succeed.call(context, start, end, fn);
+ return window.HAML.succeed.call(_this, start, end, fn);
};
$o = [];
$o.push("click");
@@ -883,11 +886,12 @@
window.JST['succeed'] = function(context) {
return (function() {
- var $c, $e, $o, succeed;
+ var $c, $e, $o, succeed,
+ _this = this;
$e = window.HAML.escape;
$c = window.HAML.cleanValue;
succeed = function(start, end, fn) {
- return SomeWhere.succeed.call(context, start, end, fn);
+ return SomeWhere.succeed.call(_this, start, end, fn);
};
$o = [];
$o.push("click");
@@ -918,11 +922,12 @@
window.JST['precede'] = function(context) {
return (function() {
- var $c, $e, $o, precede;
+ var $c, $e, $o, precede,
+ _this = this;
$e = window.HAML.escape;
$c = window.HAML.cleanValue;
precede = function(start, end, fn) {
- return window.HAML.precede.call(context, start, end, fn);
+ return window.HAML.precede.call(_this, start, end, fn);
};
$o = [];
$o.push("" + $e($c(precede('*', function() {
@@ -931,7 +936,7 @@
$o1.push("<span class='small'>Not really</span>");
return $o1.join("\\n");
}))));
- return $o.join("\\n").replace(/\\s(\\w+)='“true'/mg, ' $1').replace(/\\s(\\w+)='“false'/mg, '');
+ return $o.join("\\n").replace(/\\s(\\w+)='“true'/mg, ' $1').replace(/\\s(\\w+)='“false'/mg, '').replace(/\\s(?:id|class)=(['"])(\\1)/mg, "");
}).call(window.HAML.context(context));
};
@@ -951,11 +956,12 @@
window.JST['precede'] = function(context) {
return (function() {
- var $c, $e, $o, precede;
+ var $c, $e, $o, precede,
+ _this = this;
$e = window.HAML.escape;
$c = window.HAML.cleanValue;
precede = function(start, end, fn) {
- return SomeWhere.precede.call(context, start, end, fn);
+ return SomeWhere.precede.call(_this, start, end, fn);
};
$o = [];
$o.push("" + $e($c(precede('*', function() {
@@ -964,7 +970,7 @@
$o1.push("<span class='small'>Not really</span>");
return $o1.join("\\n");
}))));
- return $o.join("\\n").replace(/\\s(\\w+)='“true'/mg, ' $1').replace(/\\s(\\w+)='“false'/mg, '');
+ return $o.join("\\n").replace(/\\s(\\w+)='“true'/mg, ' $1').replace(/\\s(\\w+)='“false'/mg, '').replace(/\\s(?:id|class)=(['"])(\\1)/mg, "");
}).call(window.HAML.context(context));
};

0 comments on commit 395ff9e

Please sign in to comment.