From bb6d41f3dd20fca01621479e6f80844b3edc9820 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Mon, 7 Dec 2020 16:05:34 +0000 Subject: [PATCH] Macrocall widget: ensure we separately cache inline vs block parse trees Fixes a bug in #5205 --- core/modules/widgets/macrocall.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/modules/widgets/macrocall.js b/core/modules/widgets/macrocall.js index adf1f908c..2381d0360 100644 --- a/core/modules/widgets/macrocall.js +++ b/core/modules/widgets/macrocall.js @@ -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 : [];