1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-02 14:29:55 +00:00

lint: double quote

This commit is contained in:
lin onetwo 2024-10-02 13:47:41 +08:00
parent 03798d7fef
commit 1a45520909
2 changed files with 20 additions and 22 deletions

View File

@ -386,33 +386,31 @@ exports.parseAttribute = function(source,pos) {
}; };
/* /*
Given a parsed attribute node, serialize it back into its source string representation. Serialize a parsed attribute node
*/ */
exports.serializeAttribute = function(node) { exports.serializeAttribute = function(node) {
if(!node || typeof node !== 'object' || !node.name || !node.type) { if(!node || typeof node !== "object" || !node.name || !node.type) {
return null; return null;
} }
var attributeString = node.name; var attributeString = node.name;
if(node.type === "string") {
if(node.type === 'string') { if(node.value === "true") {
if(node.value === 'true') {
return attributeString; return attributeString;
} }
attributeString += '="' + node.value + '"'; attributeString += '="' + node.value + '"';
} else if(node.type === 'filtered') { } else if(node.type === "filtered") {
attributeString += '={{{' + node.filter + '}}}'; attributeString += "={{{" + node.filter + "}}}";
} else if(node.type === 'indirect') { } else if(node.type === "indirect") {
attributeString += '={{' + node.textReference + '}}'; attributeString += "={{" + node.textReference + "}}";
} else if(node.type === 'substituted') { } else if(node.type === "substituted") {
attributeString += '=`' + node.rawValue + '`'; attributeString += "=`" + node.rawValue + "`";
} else if(node.type === 'macro') { } else if(node.type === "macro") {
// Assuming macro serialization is complex and handled elsewhere // Assuming macro serialization is complex and handled elsewhere
attributeString += '=' + node.value.serialize(); attributeString += "=" + node.value.serialize();
} else { } else {
return null; // Unsupported type // Unsupported type
return null;
} }
return attributeString; return attributeString;
}; };

View File

@ -259,7 +259,7 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
var start = this.pos; var start = this.pos;
var children = this.parseInlineRun(terminatorRegExp); var children = this.parseInlineRun(terminatorRegExp);
var end = this.pos; var end = this.pos;
return [{type: "element", tag: "p", children: children, start: start, end: end, rule: 'parseBlock' }]; return [{type: "element", tag: "p", children: children, start: start, end: end, rule: "parseBlock" }];
}; };
/* /*