1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-22 19:27:40 +00:00

Extend transclude widget to optionally set variables

Partially fixes #5199
This commit is contained in:
jeremy@jermolene.com
2021-03-19 15:37:59 +00:00
parent 427eb6d085
commit 80ee5adb14
3 changed files with 44 additions and 5 deletions

View File

@@ -75,8 +75,17 @@ TranscludeWidget.prototype.execute = function() {
]}];
}
}
// Assign any variables set via attributes starting with $
var variables = Object.create(null);
$tw.utils.each(this.attributes,function(attribute,name) {
if(name.charAt(0) === "$") {
variables[name.substr(1)] = attribute;
}
});
// Construct the child widgets
this.makeChildWidgets(parseTreeNodes);
this.makeChildWidgets(parseTreeNodes,{
variables: variables
});
};
/*