[Mediawiki-l] Template expansion in extension tags?

Ken McDonald ken at pixologic.com
Sat Feb 24 23:49:52 UTC 2007


I have (successfully!) written a small extension that allows embedding 
of Quicktime .mov files, using a <qtmov> tag:

    <qtmov>320 240 my_movie.mov</qtmov>

I'd now like to write a template to wrap this so that if the extension 
changes (more arguments get added, etc.) I can just change the template 
in a way that all the previously written qt embedding using that 
template will still be valid. So, I want to do a template Template:QTMov 
that looks something like (at its simplest):

    <qtmov>{{{1}}} {{{2}}} {{{3}}}</qtmov>

However, it turns out that the template parameters aren't expanded! If 
in a document I write:

    {{QTMov|320|240|my_movie.mov}}

Then literals '{{{1}}}' etc are passed to the qtmov extension, and so 
the generated HTML ends up being something like:

    <embed width="{{{1}}}" . . . >

Is there a way to avoid this, or do I simply have to use the tag 
directly? If the latter, is there a way to give default values to 
extension args, and to pass them by name?



Once I've tested, prettified, and (hopefully) gotten the template 
working, I'll post the code to the group.


Thanks,
Ken



More information about the MediaWiki-l mailing list