1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-24 10:37:20 +00:00

Remove need to explicitly clear widget mapping variable when invoking overridden widget

This commit is contained in:
jeremy@jermolene.com 2022-04-26 14:24:31 +01:00
parent 35616a0b39
commit fae038dcbc
3 changed files with 39 additions and 8 deletions

View File

@ -88,8 +88,15 @@ UberTranscludeWidget.prototype.execute = function() {
});
}
var parseTreeNodes = parser ? parser.tree : (this.slotValueParseTrees["missing"] || []);
this.sourceText = parser ? parser.source : null;
this.parserType = parser? parser.type : null;
this.sourceText = parser ? parser.source : undefined;
this.parserType = parser? parser.type : undefined;
// Wrap the transcluded content if required
if(this.slotValueParseTrees["wrapper"]) {
this.slotValueParseTrees["wrapped"] = parseTreeNodes;
parseTreeNodes = this.slotValueParseTrees["wrapper"];
this.sourceTest = undefined;
this.sourceType = undefined;
}
// Set context variables for recursion detection
var recursionMarker = this.makeRecursionMarker();
if(this.recursionMarker === "yes") {

View File

@ -406,6 +406,32 @@ Widget.prototype.makeChildWidget = function(parseTreeNode,options) {
"$name": {name: "$name", type: "string", value: "body"}
},
children: parseTreeNode.children
},
{
type: "value",
tag: "$value",
attributes: {
"$name": {name: "$name", type: "string", value: "wrapper"}
},
children: [
{
type: "setvariable",
tag: "$setvariable",
attributes: {
"name": {name: "name", type: "string", value: variableDefinitionName},
"value": {name: "value", type: "string", value: ""}
},
children: [
{
type: "slot",
tag: "$slot",
attributes: {
"$name": {name: "$name", type: "string", value: "wrapped"}
}
}
]
}
]
}
]
};

View File

@ -15,12 +15,10 @@ title: TiddlerOne
<!-- Redefine the <$text> widget by defining a transcludable variable with that name -->
<$set name="<$text>" value="""\whitespace trim
<$parameters text='Jaguar'>
<$set name="<$text>" value="">
<$text text=<<text>>/>
<$slot $name="body">
Whale
</$slot>
</$set>
<$text text=<<text>>/>
<$slot $name="body">
Whale
</$slot>
</$parameters>"""
>
<$text text="Dingo">