underscore-source 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Underscore
2
2
  module Source
3
- VERSION = "0.5.3"
3
+ VERSION = "0.5.4"
4
4
  end
5
5
  end
@@ -38,7 +38,7 @@
38
38
  propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
39
39
 
40
40
  // Current version.
41
- _.VERSION = '0.5.3';
41
+ _.VERSION = '0.5.4';
42
42
 
43
43
  // ------------------------ Collection Functions: ---------------------------
44
44
 
@@ -561,19 +561,19 @@
561
561
 
562
562
  // JavaScript templating a-la ERB, pilfered from John Resig's
563
563
  // "Secrets of the JavaScript Ninja", page 83.
564
+ // Single-quote fix from Rick Strahl's version.
564
565
  _.template = function(str, data) {
565
566
  var fn = new Function('obj',
566
567
  'var p=[],print=function(){p.push.apply(p,arguments);};' +
567
568
  'with(obj){p.push(\'' +
568
- str
569
- .replace(/[\r\t\n]/g, " ")
570
- .split("<%").join("\t")
571
- .replace(/((^|%>)[^\t]*)'/g, "$1\r")
572
- .replace(/\t=(.*?)%>/g, "',$1,'")
573
- .split("\t").join("');")
574
- .split("%>").join("p.push('")
575
- .split("\r").join("\\'")
576
- + "');}return p.join('');");
569
+ str.replace(/[\r\t\n]/g, " ")
570
+ .replace(/'(?=[^%]*%>)/g,"\t")
571
+ .split("'").join("\\'")
572
+ .split("\t").join("'")
573
+ .replace(/<%=(.+?)%>/g, "',$1,'")
574
+ .split("<%").join("');")
575
+ .split("%>").join("p.push('")
576
+ + "');}return p.join('');");
577
577
  return data ? fn(data) : fn;
578
578
  };
579
579
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: underscore-source
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.3
5
+ version: 0.5.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel X. Moore