mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-07-04 19:12:51 +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)) {
|
if($tw.utils.hop($tw.macros,name)) {
|
||||||
var macro = $tw.macros[name],
|
var macro = $tw.macros[name],
|
||||||
args = [];
|
args = [];
|
||||||
|
if(macro.params.length > 0) {
|
||||||
var nextAnonParameter = 0, // Next candidate anonymous parameter in macro call
|
var nextAnonParameter = 0, // Next candidate anonymous parameter in macro call
|
||||||
paramInfo, paramValue;
|
paramInfo, paramValue;
|
||||||
// Step through each of the parameters in the macro definition
|
// Step through each of the parameters in the macro definition
|
||||||
@ -167,6 +168,10 @@ Widget.prototype.evaluateMacroModule = function(name,actualParams,defaultValue)
|
|||||||
// Save the parameter
|
// Save the parameter
|
||||||
args.push(paramValue);
|
args.push(paramValue);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else for(var i=0; i<actualParams.length; ++i) {
|
||||||
|
args.push(actualParams[i].value);
|
||||||
|
}
|
||||||
return macro.run.apply(this,args)
|
return macro.run.apply(this,args)
|
||||||
} else {
|
} else {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user