Hi,

When you have a parser function called from within a template, you can of course pass in to it any template parameters, like:

{{#flagicon:{{{Flag image|}}} }}

(This is a silly example, but bear with me.) I would like to instead be able to call the parser function without the parameter, like this:

{{#flagicon:}}

...and have the parser function directly get the value of the "Flag image" parameter.

I believe this can be done within Lua: when a Lua module is invoked from a template, it can get the names and values of the parameters/arguments that have been passed to that template using (I believe) code that looks like the following:

frame = mw.getCurrentFrame()
origArgs = frame:getParent().args

I tried to do something similar within a parser function's code, using various calls like the following, but nothing worked:

$frame = $parser->getPreProcessor()->newFrame()->newChild();
$args = $frame->getArguments();

Can this be done? Ideally, it would be great to get an array of all the arguments that have been passed to the template - but just being able to get the value for a specified parameter name would be good enough.

-Yaron

--
WikiWorks · MediaWiki Consulting · http://wikiworks.com