1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-23 11:47:38 +00:00

Cache parse trees when transcluding variables

This commit is contained in:
jeremy@jermolene.com
2022-05-03 17:59:45 +01:00
parent 719a5614cb
commit e99137f4cc
2 changed files with 11 additions and 2 deletions

View File

@@ -171,7 +171,13 @@ TranscludeWidget.prototype.getTransclusionTarget = function() {
if(this.transcludeVariable) {
var variableInfo = this.getVariableInfo(this.transcludeVariable).srcVariable;
if(variableInfo) {
parser = this.wiki.parseText(this.transcludeType,variableInfo.value || "",{parseAsInline: !this.parseTreeNode.isBlock});
var mode = this.parseTreeNode.isBlock ? "blockParser" : "inlineParser";
if(variableInfo[mode]) {
parser = variableInfo[mode];
} else {
parser = this.wiki.parseText(this.transcludeType,variableInfo.value || "",{parseAsInline: !this.parseTreeNode.isBlock});
variableInfo[mode] = parser;
}
if(parser && variableInfo.isFunctionDefinition) {
parser = {
tree: [