mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-03 14:59:57 +00:00
Simplify metaparameters implementation
This commit is contained in:
parent
b57a6da548
commit
542df63ccf
@ -68,15 +68,12 @@ ParametersWidget.prototype.execute = function() {
|
|||||||
self.setVariable(name,value);
|
self.setVariable(name,value);
|
||||||
});
|
});
|
||||||
// Assign any metaparameters
|
// Assign any metaparameters
|
||||||
var assignMetaParameter = function(name) {
|
$tw.utils.each(pointer.getTransclusionMetaParameters(),function(getValue,name) {
|
||||||
var variableName = self.getAttribute("$" + name);
|
var variableName = self.getAttribute("$" + name);
|
||||||
if(variableName !== undefined) {
|
if(variableName !== undefined) {
|
||||||
self.setVariable(variableName,pointer.getTransclusionMetaParameter(name));
|
self.setVariable(variableName,getValue(name));
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
assignMetaParameter("parseAsInline");
|
|
||||||
assignMetaParameter("parseTreeNodes");
|
|
||||||
assignMetaParameter("params");
|
|
||||||
}
|
}
|
||||||
// Construct the child widgets
|
// Construct the child widgets
|
||||||
this.makeChildWidgets();
|
this.makeChildWidgets();
|
||||||
|
@ -306,19 +306,22 @@ TranscludeWidget.prototype.getTransclusionParameter = function(name,index,defaul
|
|||||||
/*
|
/*
|
||||||
Get one of the special parameters to be provided by the parameters widget
|
Get one of the special parameters to be provided by the parameters widget
|
||||||
*/
|
*/
|
||||||
TranscludeWidget.prototype.getTransclusionMetaParameter = function(name) {
|
TranscludeWidget.prototype.getTransclusionMetaParameters = function() {
|
||||||
switch(name) {
|
var self = this;
|
||||||
case "parseAsInline":
|
return {
|
||||||
return this.parseAsInline ? "yes" : "no";
|
"parseAsInline": function() {
|
||||||
case "parseTreeNodes":
|
return self.parseAsInline ? "yes" : "no";
|
||||||
return JSON.stringify(this.parseTreeNode);
|
},
|
||||||
case "slotFillParseTrees":
|
"parseTreeNodes": function() {
|
||||||
return JSON.stringify(this.slotFillParseTrees);
|
return JSON.stringify(self.parseTreeNode);
|
||||||
case "params":
|
},
|
||||||
return JSON.stringify(this.stringParametersByName);
|
"slotFillParseTrees": function() {
|
||||||
default:
|
return JSON.stringify(self.slotFillParseTrees);
|
||||||
return "";
|
},
|
||||||
}
|
"params": function() {
|
||||||
|
JSON.stringify(self.stringParametersByName);
|
||||||
|
}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user