1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-01 17:53:15 +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"] || []); var parseTreeNodes = parser ? parser.tree : (this.slotValueParseTrees["missing"] || []);
this.sourceText = parser ? parser.source : null; this.sourceText = parser ? parser.source : undefined;
this.parserType = parser? parser.type : null; 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 // Set context variables for recursion detection
var recursionMarker = this.makeRecursionMarker(); var recursionMarker = this.makeRecursionMarker();
if(this.recursionMarker === "yes") { if(this.recursionMarker === "yes") {

View File

@ -406,6 +406,32 @@ Widget.prototype.makeChildWidget = function(parseTreeNode,options) {
"$name": {name: "$name", type: "string", value: "body"} "$name": {name: "$name", type: "string", value: "body"}
}, },
children: parseTreeNode.children 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 --> <!-- Redefine the <$text> widget by defining a transcludable variable with that name -->
<$set name="<$text>" value="""\whitespace trim <$set name="<$text>" value="""\whitespace trim
<$parameters text='Jaguar'> <$parameters text='Jaguar'>
<$set name="<$text>" value=""> <$text text=<<text>>/>
<$text text=<<text>>/> <$slot $name="body">
<$slot $name="body"> Whale
Whale </$slot>
</$slot>
</$set>
</$parameters>""" </$parameters>"""
> >
<$text text="Dingo"> <$text text="Dingo">