I'm trying to create a template to encapsulate an extension. I'd like to call the extension passing the template parameters. Something like:
<extension-tag name="{{{1}}}" />
The problem is that the extension receives the string "{{{1}}}" and not the actual parameter. Searching this mailing list I found out that other users had the same problem but I could not find a definite answer.
Is there a way to do this?
On 18/12/06, Fernando Correia fernandoacorreia@gmail.com wrote:
I'm trying to create a template to encapsulate an extension. I'd like to call the extension passing the template parameters. Something like:
<extension-tag name="{{{1}}}" />
The problem is that the extension receives the string "{{{1}}}" and not the actual parameter. Searching this mailing list I found out that other users had the same problem but I could not find a definite answer.
I rather suspect that at present, at the time we strip out extension tags for processing, we're not evaluating template parameters in content or attributes.
If that's the case, then it might be something we can change, but at present, the answer is that there isn't a simple means of doing it.
Rob Church
Thank you for you answer. Do you think I should file this as a feature request on the bug database?
2006/12/18, Rob Church robchur@gmail.com:
I rather suspect that at present, at the time we strip out extension tags for processing, we're not evaluating template parameters in content or attributes.
If that's the case, then it might be something we can change, but at present, the answer is that there isn't a simple means of doing it.
On 18/12/06, Fernando Correia fernandoacorreia@gmail.com wrote:
Thank you for you answer. Do you think I should file this as a feature request on the bug database?
Sure, if it's not already there.
Rob Church
In case someone reads this thread in the future: it is possible to pass template parameters to an extension using parser functions.
I created a parser function that just returns the extension tag. The parser function receives the template parameters already replaced.
A strange thing is that if a parameter is optional in the template, the parser function receives that parameter as {{{3}}}, {{{4}}}. I used a code like this to ignore it inside the parser function:
if (strpos($filename, "{{{") === 0) $filename = '';
mediawiki-l@lists.wikimedia.org