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) {
if(!node || typeof node !== 'object' || !node.name || !node.type) {
return null;
if(!node || typeof node !== "object" || !node.name || !node.type) {
return null;
}
var attributeString = node.name;
if(node.type === 'string') {
if(node.value === 'true') {
return attributeString;
}
attributeString += '="' + node.value + '"';
} else if(node.type === 'filtered') {
attributeString += '={{{' + node.filter + '}}}';
} else if(node.type === 'indirect') {
attributeString += '={{' + node.textReference + '}}';
} else if(node.type === 'substituted') {
attributeString += '=`' + node.rawValue + '`';
} else if(node.type === 'macro') {
// Assuming macro serialization is complex and handled elsewhere
attributeString += '=' + node.value.serialize();
if(node.type === "string") {
if(node.value === "true") {
return attributeString;
}
attributeString += '="' + node.value + '"';
} else if(node.type === "filtered") {
attributeString += "={{{" + node.filter + "}}}";
} else if(node.type === "indirect") {
attributeString += "={{" + node.textReference + "}}";
} else if(node.type === "substituted") {
attributeString += "=`" + node.rawValue + "`";
} else if(node.type === "macro") {
// Assuming macro serialization is complex and handled elsewhere
attributeString += "=" + node.value.serialize();
} else {
return null; // Unsupported type
// Unsupported type
return null;
}
return attributeString;
};

View File

@ -259,7 +259,7 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
var start = this.pos;
var children = this.parseInlineRun(terminatorRegExp);
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" }];
};
/*