mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-10 04:36:38 +00:00
Refactored stringily not to add the double quotes
This commit is contained in:
parent
b32826f110
commit
b92e011c66
@ -52,10 +52,10 @@ JavaScriptParseTree.prototype.renderNode = function(output,node) {
|
||||
var p;
|
||||
switch(node.type) {
|
||||
case "StringLiteral":
|
||||
output.push(utils.stringify(node.value));
|
||||
output.push('"' + utils.stringify(node.value) + '"');
|
||||
break;
|
||||
case "StringLiterals":
|
||||
output.push(utils.stringify(node.value.join("")));
|
||||
output.push('"' + utils.stringify(node.value.join("")) + '"');
|
||||
break;
|
||||
case "FunctionCall":
|
||||
output.push("(");
|
||||
|
@ -227,12 +227,13 @@ utils.stringify = function(s) {
|
||||
*
|
||||
* For portability, we also escape escape all non-ASCII characters.
|
||||
*/
|
||||
return '"' + s
|
||||
return s
|
||||
.replace(/\\/g, '\\\\') // backslash
|
||||
.replace(/"/g, '\\"') // closing quote character
|
||||
.replace(/"/g, '\\"') // double quote character
|
||||
.replace(/'/g, "\\'") // single quote character
|
||||
.replace(/\r/g, '\\r') // carriage return
|
||||
.replace(/\n/g, '\\n') // line feed
|
||||
.replace(/[\x80-\uFFFF]/g, utils.escape) + '"'; // non-ASCII characters
|
||||
.replace(/[\x80-\uFFFF]/g, utils.escape); // non-ASCII characters
|
||||
};
|
||||
|
||||
// Creates an HTML element string from these arguments:
|
||||
|
Loading…
x
Reference in New Issue
Block a user