app/assets/javascripts/encode_html.js in sprockets-dotjs-2.0.3 vs app/assets/javascripts/encode_html.js in sprockets-dotjs-2.1.0
- old
+ new
@@ -1,7 +1,7 @@
function encodeHTMLSource() {
- var encodeHTMLRules = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/' },
- matchHTML = /&(?!#?\w+;)|<|>|"|'|\//g;
+ var encodeHTMLRules = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/', "\n": '<br>' },
+ matchHTML = /&(?!#?\w+;)|<|>|"|'|\/\n/g;
return function() {
return this ? this.replace(matchHTML, function(m) {return encodeHTMLRules[m] || m;}) : this;
};
}
String.prototype.encodeHTML = encodeHTMLSource();
\ No newline at end of file