On 05/22/2012 03:16 PM, Nikola Smolenski wrote:
I see no reason for creating a new parser function for
inclusion of
templates. Also, this syntax would not allow a template to draw data
from more than one item, which would probably be a requirement in phase3.
Rather, I would include a template normally and use a parser function
within the template to access the data.
So, instead of {{{data}}} there would be {{#data:}}, instead of
{{{data.color}}} there would be {{#data:color}}, instead of
{{{data.color(ACME_SURVEY_2010)}}} there would be
{{#data:color|ref=ACME_SURVEY_2010}} and so on.
This could even be simplified further to
{{#data:{{{data_item}}}|color}}
The syntax is admittedly longer, but would work as-is with alternate
parsers such as Parsoid or a generic parser function API in Lua. It
would also preserve referential transparency as far as possible, which
is good for finer-grained caching.
The parser function should be able to override itself
by template
parameters - I believe it is possible to do this.
I'd strongly recommend against any magic like this, as it makes
templates even harder to understand and also harder to cache.
Gabriel