Commit f0c2e8b1 authored by Andi Sidwell's avatar Andi Sidwell
Browse files

Normalise linebreaks before escaping them

parent 2d46a933
...@@ -28,13 +28,9 @@ module.exports.formatDate = function formatDate(d, dateonly, floating) { ...@@ -28,13 +28,9 @@ module.exports.formatDate = function formatDate(d, dateonly, floating) {
}; };
module.exports.escape = function escape(str) { module.exports.escape = function escape(str) {
return str.replace(/[\\;,\n"]/g, function(match) { return str.replace(/[\\;,"]/g, function(match) {
if(match === '\n') {
return '\\n';
}
return '\\' + match; return '\\' + match;
}); }).replace(/(?:\r\n|\r|\n)/g, '\\n');
}; };
module.exports.duration = function duration(seconds) { module.exports.duration = function duration(seconds) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment