Last modified: 2011-03-13 18:06:52 UTC
If a template includes a parser function passing parameters and some of these parameters are empty, the parameter reference {{{n}}} is passed to the parser function. An empty string should be passed. For instance, the template includes: {{#swf:{{{1}}}|{{{2}}}|{{{3}}}|{{{4}}}}} The parser function declaration is: function wfPlaySwfParserFunctionRender( &$parser, $filename = '', $filetitle = '', $width='', $height='' ) If a template is used with only two parameters, $width and $heigth receive "{{{3}}}" and "{{{4}}}" in the parser function. They should be empty.
Um, isn't this what parameter defaults are for? {{{1|}}} will return empty if 1 is undefined.
You may be right. But I think it's odd that an extension should receive such a string. It seems like the template parameter syntax should be resolved within the template, not exposed.
It's no more odd than specifying that a function should receive an object reference (eg &$parser) rather than a scalar value (eg $filename). In both cases you have to make sure that you pass the correct kind of parameter otherwise your code is not going to work. The point here is that the wiki-text "{{{3}}}" is defined to be the value of anonymous parameter #3 unless that parameter is blank in which case the default value is "{{{3}}}". Changing that definition would breaking existing usage and is unlikely to happen. Having your function validate its input would probably be your best bet.
OK, thanks.