On 05/22/2012 03:49 PM, Daniel Kinzler wrote:
On 22.05.2012 15:15, Nikola Smolenski wrote: 2) alternatively, don't pass item from the article to the template at all. Instead, use parser functions for every access to an item property, and specify the item id as a parameter if necessary. That would create a lot of rundundancy and wouldn't allow "normal" template parameter syntax to be used to access data properties.
You could still pass the data item to the template:
{{Infobox|di=q556677}}
and inside Template:Infobox:
{{#data:{{{di}}}|color}}
This is admittedly slightly more verbose.
On the other hand, It would also work in articles, and supports multiple items in a single template. More importantly (to me), it is familiar to current editors, compatible with alternate parsers (e.g. Parsoid) or a generic Lua -> parser function API and makes it easier to implement generic fragment caching.
Overall I'd prefer any magic-free and forward-compatible solution even if it comes at the cost of small syntactic inconveniences.
Gabriel