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
Tag extensions don't receive translated template parameters (as you've discovered).
If you really need this functionality, you should consider writing a parser function:
http://meta.wikimedia.org/wiki/Extending_wiki_markup#Parser_functions
-- Jim
On 2/24/07, Ken McDonald ken@pixologic.com wrote:
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
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org