1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-03 10:43:16 +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: [

View File

@ -23,7 +23,10 @@ title: TiddlerOne
<$mywidget one="Dingo">
Crocodile
</$mywidget>
<$mywidget one="BumbleBee">
Squirrel
</$mywidget>
+
title: ExpectedResult
<p>DingoCrocodile</p>
<p>DingoCrocodileBumbleBeeSquirrel</p>