1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-27 18:40:28 +00:00

Macrocall widget: ensure we separately cache inline vs block parse trees

Fixes a bug in #5205
This commit is contained in:
jeremy@jermolene.com 2020-12-07 16:05:34 +00:00
parent a878d82c7a
commit bb6d41f3dd

View File

@ -56,14 +56,15 @@ MacroCallWidget.prototype.execute = function() {
if(this.renderOutput === "text/html") {
// If so we'll return the parsed macro
// Check if we've already cached parsing this macro
var parser;
if(variableInfo.srcVariable && variableInfo.srcVariable.parser) {
parser = variableInfo.srcVariable.parser;
var mode = this.parseTreeNode.isBlock ? "blockParser" : "inlineParser",
parser;
if(variableInfo.srcVariable && variableInfo.srcVariable[mode]) {
parser = variableInfo.srcVariable[mode];
} else {
parser = this.wiki.parseText(this.parseType,text,
{parseAsInline: !this.parseTreeNode.isBlock});
if(variableInfo.isCacheable && variableInfo.srcVariable) {
variableInfo.srcVariable.parser = parser;
variableInfo.srcVariable[mode] = parser;
}
}
var parseTreeNodes = parser ? parser.tree : [];