mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-25 07:02:25 +00:00
wikiparser.js needs to handle child-arrays to check for text-nodes
This commit is contained in:
parent
0f786d8fd1
commit
75b041e562
@ -242,13 +242,30 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
|
|||||||
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 }];
|
// return [{type: "element", tag: "p", children: children, start: start, end: end }];
|
||||||
if (children[0].type === "text" ||
|
|
||||||
(($tw.config.htmlBlockElements.indexOf(children[0].tag) === -1) && children[0] &&
|
var isP = false;
|
||||||
children[0].tag && children[0].tag.charAt(0) !== "$")) {
|
$tw.utils.each(children, function(child) {
|
||||||
|
if (child.type === "text" ||
|
||||||
|
(($tw.config.htmlBlockElements.indexOf(child.tag) === -1) &&
|
||||||
|
child.tag && child.tag.charAt(0) !== "$")) {
|
||||||
|
isP = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isP) {
|
||||||
return [{type: "element", tag: "p", children: children, start: start, end: end }];
|
return [{type: "element", tag: "p", children: children, start: start, end: end }];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (children[0].type === "text" ||
|
||||||
|
// (($tw.config.htmlBlockElements.indexOf(children[0].tag) === -1) && children[0] &&
|
||||||
|
// children[0].tag && children[0].tag.charAt(0) !== "$")) {
|
||||||
|
// return [{type: "element", tag: "p", children: children, start: start, end: end }];
|
||||||
|
// } else {
|
||||||
|
// return children;
|
||||||
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user