mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-07-04 11:13:15 +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;
|
var p;
|
||||||
switch(node.type) {
|
switch(node.type) {
|
||||||
case "StringLiteral":
|
case "StringLiteral":
|
||||||
output.push(utils.stringify(node.value));
|
output.push('"' + utils.stringify(node.value) + '"');
|
||||||
break;
|
break;
|
||||||
case "StringLiterals":
|
case "StringLiterals":
|
||||||
output.push(utils.stringify(node.value.join("")));
|
output.push('"' + utils.stringify(node.value.join("")) + '"');
|
||||||
break;
|
break;
|
||||||
case "FunctionCall":
|
case "FunctionCall":
|
||||||
output.push("(");
|
output.push("(");
|
||||||
|
|
|
@ -227,12 +227,13 @@ utils.stringify = function(s) {
|
||||||
*
|
*
|
||||||
* For portability, we also escape escape all non-ASCII characters.
|
* For portability, we also escape escape all non-ASCII characters.
|
||||||
*/
|
*/
|
||||||
return '"' + s
|
return s
|
||||||
.replace(/\\/g, '\\\\') // backslash
|
.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(/\r/g, '\\r') // carriage return
|
||||||
.replace(/\n/g, '\\n') // line feed
|
.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:
|
// Creates an HTML element string from these arguments:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user