mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
lint: useless ai generated comments
This commit is contained in:
parent
08e9312295
commit
398d7f7fe7
@ -38,8 +38,7 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree) {
|
||||
var dash = tree.entity === "–" ? "--" : "---";
|
||||
return dash;
|
||||
return tree.entity === "–" ? "--" : "---";
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -48,13 +48,7 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree, serialize) {
|
||||
var serialized = "''";
|
||||
// Serialize the children of the bold element
|
||||
serialized += serialize(tree.children);
|
||||
// Close the serialized string with the closing delimiter
|
||||
serialized += "''";
|
||||
// Return the complete serialized string
|
||||
return serialized;
|
||||
return "''" + serialize(tree.children) + "''";
|
||||
};
|
||||
|
||||
})();
|
@ -48,13 +48,7 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree, serialize) {
|
||||
var serialized = "//";
|
||||
// Serialize the children of the italic element
|
||||
serialized += serialize(tree.children);
|
||||
// Close the serialized string with the closing delimiter
|
||||
serialized += "//";
|
||||
// Return the complete serialized string
|
||||
return serialized;
|
||||
return "//" + serialize(tree.children) + "//";
|
||||
};
|
||||
|
||||
})();
|
@ -48,13 +48,7 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree, serialize) {
|
||||
var serialized = "~~";
|
||||
// Serialize the children of the strikethrough element
|
||||
serialized += serialize(tree.children);
|
||||
// Close the serialized string with the closing delimiter
|
||||
serialized += "~~";
|
||||
// Return the complete serialized string
|
||||
return serialized;
|
||||
return "~~" + serialize(tree.children) + "~~";
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -48,13 +48,7 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree, serialize) {
|
||||
var serialized = ",,";
|
||||
// Serialize the children of the subscript element
|
||||
serialized += serialize(tree.children);
|
||||
// Close the serialized string with the closing delimiter
|
||||
serialized += ",,";
|
||||
// Return the complete serialized string
|
||||
return serialized;
|
||||
return ",," + serialize(tree.children) + ",,";
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -48,13 +48,7 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree, serialize) {
|
||||
var serialized = "^^";
|
||||
// Serialize the children of the superscript element
|
||||
serialized += serialize(tree.children);
|
||||
// Close the serialized string with the closing delimiter
|
||||
serialized += "^^";
|
||||
// Return the complete serialized string
|
||||
return serialized;
|
||||
return "^^" + serialize(tree.children) + "^^";
|
||||
};
|
||||
|
||||
})();
|
@ -48,13 +48,7 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree, serialize) {
|
||||
var serialized = "__";
|
||||
// Serialize the children of the underscore element
|
||||
serialized += serialize(tree.children);
|
||||
// Close the serialized string with the closing delimiter
|
||||
serialized += "__";
|
||||
// Return the complete serialized string
|
||||
return serialized;
|
||||
return "__" + serialize(tree.children) + "__";
|
||||
};
|
||||
|
||||
})();
|
@ -37,7 +37,6 @@ exports.parse = function() {
|
||||
return [{type: "entity", entity: this.match[0]}];
|
||||
};
|
||||
|
||||
// Serialize method for the entity rule
|
||||
exports.serialize = function(tree, serialize) {
|
||||
return tree.entity;
|
||||
};
|
||||
|
@ -60,15 +60,14 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree,serialize) {
|
||||
// we get each of element on tree from `parse` one by one here.
|
||||
var text = tree.tag === 'br' ? '\n' : tree.text;
|
||||
var text = tree.tag === "br" ? "\n" : (tree.text || "");
|
||||
if(tree.isRuleStart) {
|
||||
return '"""\n' + text;
|
||||
}
|
||||
if(tree.isRuleEnd) {
|
||||
return text + '"""';
|
||||
}
|
||||
return text;
|
||||
return text + serialize(tree.children);
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -66,7 +66,7 @@ exports.parse = function() {
|
||||
}
|
||||
tag.end = this.parser.pos;
|
||||
tag.closeTagEnd = tag.end;
|
||||
if(tag.closeTagEnd === tag.openTagEnd || this.parser.source[tag.closeTagEnd - 1] !== '>') {
|
||||
if(tag.closeTagEnd === tag.openTagEnd || this.parser.source[tag.closeTagEnd - 1] !== ">") {
|
||||
tag.closeTagStart = tag.end;
|
||||
} else {
|
||||
tag.closeTagStart = tag.closeTagEnd - 2;
|
||||
@ -74,11 +74,11 @@ exports.parse = function() {
|
||||
if(!Number.isSafeInteger(closeTagMinPos)) closeTagMinPos = tag.openTagEnd;
|
||||
while(tag.closeTagStart >= closeTagMinPos) {
|
||||
var char = this.parser.source[tag.closeTagStart];
|
||||
if(char === '>') {
|
||||
if(char === ">") {
|
||||
tag.closeTagStart = -1;
|
||||
break;
|
||||
}
|
||||
if(char === '<') break;
|
||||
if(char === "<") break;
|
||||
tag.closeTagStart -= 1;
|
||||
}
|
||||
if(tag.closeTagStart < closeTagMinPos) {
|
||||
@ -199,9 +199,9 @@ exports.serialize = function(tree, serialize) {
|
||||
var tag = tree.tag;
|
||||
var attributes = Object.keys(tree.attributes).map(function(key) {
|
||||
return key + '="' + tree.attributes[key].value + '"';
|
||||
}).join('');
|
||||
}).join("");
|
||||
// Children
|
||||
var children = tree.children ? serialize(tree.children) : '';
|
||||
var children = tree.children ? serialize(tree.children) : "";
|
||||
// Self-closing tag
|
||||
if(tree.isSelfClosing) {
|
||||
return "<" + tag + (attributes ? " " + attributes : "") + " />";
|
||||
|
@ -52,9 +52,8 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree,serialize) {
|
||||
// Filter attribute
|
||||
var filter = tree.attributes.filter.value;
|
||||
// Construct the serialized string with children that is actually the sibling below the pragma.
|
||||
// Sibling below the pragma become children, so we append the serialized children to the end..
|
||||
return "\\import " + filter + "\n" + serialize(tree.children);
|
||||
};
|
||||
|
||||
|
@ -57,16 +57,16 @@ exports.parse = function() {
|
||||
Serialize a macro call node to wikitext
|
||||
*/
|
||||
exports.serialize = function (node) {
|
||||
// Start with macro opener
|
||||
var result = "<<";
|
||||
// Macro name
|
||||
if(node.attributes && node.attributes["$variable"]) {
|
||||
result += node.attributes["$variable"].value; // Add macro name
|
||||
result += node.attributes["$variable"].value;
|
||||
}
|
||||
// Append ordered arguments if any
|
||||
if(node.orderedAttributes) {
|
||||
node.orderedAttributes.forEach(function (attr) {
|
||||
if(attr.name !== "$variable") {
|
||||
result += " " + '"' + attr.value + '"'; // Add each additional value
|
||||
result += " " + '"' + attr.value + '"';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -90,15 +90,11 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree,serialize) {
|
||||
// Macro name
|
||||
var name = tree.attributes.name.value;
|
||||
// Parameters
|
||||
var params = tree.params.map(function(param) {
|
||||
return param.name + (param.default ? ":" + param.default : "");
|
||||
}).join(",");
|
||||
// Definition text
|
||||
var definition = tree.attributes.value.value;
|
||||
// Construct the serialized string
|
||||
return "\\define " + name + "(" + params + ")\n" + definition + "\n\\end\n\n" + serialize(tree.children);
|
||||
};
|
||||
|
||||
|
@ -58,11 +58,9 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree,serialize) {
|
||||
// Parameters
|
||||
var params = tree.orderedAttributes.map(function(param) {
|
||||
return param.name + (param.value ? ":" + param.value : "");
|
||||
}).join(",");
|
||||
// Construct the serialized string
|
||||
return "\\parameters(" + params + ")\n\n" + serialize(tree.children);
|
||||
};
|
||||
|
||||
|
@ -118,11 +118,8 @@ exports.parseLink = function(source,pos) {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree) {
|
||||
// Tooltip text
|
||||
var tooltip = tree.children[0].text;
|
||||
// URL
|
||||
var url = tree.attributes.href.value;
|
||||
// Construct the serialized string
|
||||
return "[ext[" + (tooltip !== url ? tooltip + "|" : "") + url + "]]";
|
||||
};
|
||||
|
||||
|
@ -68,11 +68,8 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree) {
|
||||
// Link text
|
||||
var text = tree.children[0].text;
|
||||
// Link target
|
||||
var target = tree.attributes.to ? tree.attributes.to.value : tree.attributes.href.value;
|
||||
// Construct the serialized string
|
||||
return "[[" + text + (text !== target ? "|" + target : "") + "]]";
|
||||
};
|
||||
|
||||
|
@ -53,11 +53,9 @@ exports.parse = function() {
|
||||
exports.serialize = function(tree, serialize) {
|
||||
// Check if the link is suppressed
|
||||
var isSuppressed = tree.children[0].text.substr(0,1) === "~";
|
||||
|
||||
var serialized = isSuppressed ? "~" : "";
|
||||
// Append the link value
|
||||
// Append the link text
|
||||
serialized += tree.attributes.to.value;
|
||||
// Return the complete serialized string
|
||||
return serialized;
|
||||
};
|
||||
|
||||
|
@ -130,9 +130,7 @@ exports.serialize = function(tree, serialize) {
|
||||
} else if(tree.type === "transclude") {
|
||||
handleTransclude(tree);
|
||||
}
|
||||
// Close the result string
|
||||
result += "}}\n\n";
|
||||
// Return the complete result string
|
||||
return result;
|
||||
};
|
||||
|
||||
|
@ -78,6 +78,7 @@ exports.parse = function() {
|
||||
container = $tw.fakeDocument.createElement("div");
|
||||
widgetNode.render(container,null);
|
||||
var renderResult = renderType === "text/html" ? container.innerHTML : container.textContent;
|
||||
// Use void node to carry important info for typedblock
|
||||
return [{
|
||||
type: "void",
|
||||
children: [{
|
||||
@ -99,7 +100,6 @@ exports.parse = function() {
|
||||
|
||||
exports.serialize = function (tree, serialize) {
|
||||
if(tree.type === "void") {
|
||||
// Directly process the tree's text content
|
||||
return "$$$" + tree.parseType + (tree.renderType ? " > " + tree.renderType : "") + "\n" + tree.text + "\n$$$\n\n";
|
||||
}
|
||||
return "";
|
||||
|
@ -66,7 +66,6 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree, serialize) {
|
||||
// Check if the link is suppressed
|
||||
var isSuppressed = tree.children[0].text.substr(0,1) === $tw.config.textPrimitives.unWikiLink;
|
||||
|
||||
var serialized = isSuppressed ? $tw.config.textPrimitives.unWikiLink : "";
|
||||
|
Loading…
Reference in New Issue
Block a user