mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-25 00:16:52 +00:00
allowing variable number of arguments for non-argument macros
This commit is contained in:
parent
489b40314b
commit
853cca906c
@ -143,6 +143,7 @@ Widget.prototype.evaluateMacroModule = function(name,actualParams,defaultValue)
|
||||
if($tw.utils.hop($tw.macros,name)) {
|
||||
var macro = $tw.macros[name],
|
||||
args = [];
|
||||
if(macro.params.length > 0) {
|
||||
var nextAnonParameter = 0, // Next candidate anonymous parameter in macro call
|
||||
paramInfo, paramValue;
|
||||
// Step through each of the parameters in the macro definition
|
||||
@ -167,6 +168,10 @@ Widget.prototype.evaluateMacroModule = function(name,actualParams,defaultValue)
|
||||
// Save the parameter
|
||||
args.push(paramValue);
|
||||
}
|
||||
}
|
||||
else for(var i=0; i<actualParams.length; ++i) {
|
||||
args.push(actualParams[i].value);
|
||||
}
|
||||
return macro.run.apply(this,args)
|
||||
} else {
|
||||
return defaultValue;
|
||||
|
Loading…
Reference in New Issue
Block a user