Hello.
I was wondering whether it would be possible or not to have extended {{msg:}} syntax which could include parameters. Maybe the name of the page (so we could link to discussion/article page easily), or any user-defined parameter. The aim would be to use {{msg:}} as a template, so that if you decide to change something, it'll change on all pages - with specific text to each page.
Example: a {{msg:MovieHeader}} message would do a small table with movie title, original title, country, duration, director. It'd be inserted in movie articles, so you could have a quick glance at the movie's 'basic' information, and still since it's a {{msg:}} it's easy to change the format as needed.
Of course, since bots are becoming powerful, they could be used to replace text in case of a format change. But it'd be easier.
On the other hand, the syntax for parameters may be harder to understand for a beginner. Something like {{msg:MovieHeader {title} {country} ...}} may look confusing ^.^
Just my 2 cents of €
Nicolas 'Ryo'
Nicolas Weeger wrote:
I was wondering whether it would be possible or not to have extended {{msg:}} syntax which could include parameters.
Yes, of course this would be possible. And of course people have already had this idea. It's just that nobody has gotten around to actually coding it yet.
I imagine this would require some detailed specification and planning before implementation, or else we run into flexibility problems later.
For instance, an obvious solution would be to have $1, $2, etc. in the template. However, once you think about it, you realise that this is stupid because (a) you can only have ten parameters, unless you come up with some complicated syntax to specify whether $10 is supposed to mean [$1] + 0 or [$10]; (b) you can't easily obsolete a parameter you no longer need, because it would shift all the other parameters to other names; (c) it simply doesn't tell you what they mean (d) various other reasons
I suppose a much better idea would be key-value pairs, e.g. {{msg:Template|name=Robert E. Lee|born=19.01.1807|died=12.10.1870}} and then using {$name}, {$born}, {$died} in the MediaWiki text.
This is still rather unflexible because it doesn't allow for (a) default values if a parameter isn't specified (b) conditional inclusion of stuff (e.g. a table row) (c) lists/arrays
It is difficult to come up with a use for the latter, but the former two are very important.
It only gets more and more complicated. :)
Timwi
wikitech-l@lists.wikimedia.org