1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-22 11:17:39 +00:00

Transclude: replace paramNames/paramValues with more robust JSON payload

More details at https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1123719153
This commit is contained in:
jeremy@jermolene.com
2022-05-11 13:51:11 +01:00
parent a827290332
commit 774459fa73
6 changed files with 293 additions and 33 deletions

View File

@@ -317,30 +317,11 @@ TranscludeWidget.prototype.getTransclusionParameter = function(name,index,defaul
Get a hashmap of the special variables to be provided by the parameters widget
*/
TranscludeWidget.prototype.getTransclusionMetaVariables = function() {
return {
paramNames: $tw.utils.stringifyList(this.getTransclusionParameterNames()),
paramValues: $tw.utils.stringifyList(this.getTransclusionParameterValues()),
parseAsInline: this.parseAsInline ? "yes" : "no"
}
};
/*
Get an array of the names of all the provided transclusion parameters
*/
TranscludeWidget.prototype.getTransclusionParameterNames = function() {
return Object.keys(this.stringParametersByName);
};
/*
Get an array of the values of all the provided transclusion parameters
*/
TranscludeWidget.prototype.getTransclusionParameterValues = function() {
var self = this,
values = [];
$tw.utils.each(Object.keys(this.stringParametersByName),function(name) {
values.push(self.stringParametersByName[name] || "");
});
return values;
var variables = {
"@parseAsInline": this.parseAsInline ? "yes" : "no",
"@params": JSON.stringify(this.stringParametersByName)
};
return variables;
};
/*