Use backslashes instead of concatenation for multiline strings. #960

This commit is contained in:
ccd0 2016-06-17 21:29:29 -07:00
parent b569a8dbbd
commit 9426dab656
3 changed files with 3 additions and 2 deletions

View File

@ -821,7 +821,7 @@ Config =
favicon: 'ferongr'
usercss: `<%= multiline(read('user.css')) %>`
usercss: `<%= JSON.stringify(read('user.css')) %>`
hotkeys:
# QR & Options

View File

@ -5,6 +5,7 @@
"expr": true,
"sub": true,
"scripturl": true,
"multistr": true,
"browser": true,
"devel": true,
"nonstandard": true,

View File

@ -21,7 +21,7 @@ tools.readHTML = function(filename) {
};
tools.multiline = function(text) {
return text.replace(/\n+/g, '\n').split(/^/m).map(JSON.stringify).join(' +\n').replace(/`/g, '\\`');
return text.replace(/\n+/g, '\n').split(/^/m).map(JSON.stringify).join('+').replace(/"\+"/g, '\\\n');
};
// Convert JSON object to Coffeescript expression (via embedded JS).