1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-05 23:10:28 +00:00

fix: render invisible comment and parsemode as data element

This commit is contained in:
lin onetwo 2024-08-04 00:48:29 +08:00
parent 2a75077747
commit c39297698f
6 changed files with 9 additions and 6 deletions

View File

@ -55,7 +55,8 @@ exports.parse = function() {
var commentEnd = this.endMatch.index + this.endMatch[0].length;
var commentText = this.parser.source.slice(commentStart, commentEnd);
return [{
type: "commentblock",
type: "element",
tag: "data",
text: commentText,
start: commentStart,
end: commentEnd

View File

@ -48,7 +48,8 @@ exports.parse = function() {
var commentEnd = this.endMatch.index + this.endMatch[0].length;
var commentText = this.parser.source.slice(commentStart, commentEnd);
return [{
type: "commentinline",
type: "element",
tag: "data",
text: commentText,
start: commentStart,
end: commentEnd

View File

@ -89,7 +89,7 @@ exports.parse = function() {
return parseTreeNodes;
};
exports.serialize = function(tree) {
exports.serialize = function(tree,serialize) {
// Macro name
var name = tree.attributes.name.value;
// Parameters

View File

@ -57,7 +57,7 @@ exports.parse = function() {
}];
};
exports.serialize = function(tree) {
exports.serialize = function(tree,serialize) {
// Parameters
var params = tree.orderedAttributes.map(function(param) {
return param.name + (param.value ? ":" + param.value : "");

View File

@ -63,7 +63,8 @@ exports.parse = function() {
}
}
return [{
type: "parsermode",
type: "element",
tag: "data",
parseAsInline: this.parser.parseAsInline,
start: start,
end: this.parser.pos

View File

@ -133,7 +133,7 @@ exports.serializeParseTree = function serializeParseTree(tree,tiddlerType) {
$tw.utils.each(tree,function(node) {
output.push(serializeParseTree(node,tiddlerType));
});
} else {
} else if(tree) {
if(tree.type === "text" && !tree.rule) {
output.push(tree.text);
} else {