I think that would be a nice feature to have. Amazingly enough, WikiScripts is not of the
extensions that we have in our codebase at wikia (I think we're over 800+), but I will
take a look at the implementation. The <lua> parser hook allows for parameters, but
that's not the same. Having access to normal template parameters would allow a lua
template to act as a drop in replacement for an existing template, which is essential.
We are in a code freeze period here @ wikia, but when we return from the holidays in
January I can get the Lua extension enabled on a test wiki (
lua.wikia.com) so that other
people can experiment with this.
On Dec 21, 2011, at 9:29 PM, Dmitriy Sintsov wrote:
* Owen Davis <owen(a)wikia-inc.com> [Wed, 21 Dec
2011 19:18:46 +0000
(UTC)]:
It is littered with embedded HTML and
string.format statements. Ugh.
I'm going to look at something simple like Moustache (which has both
JS and Lua implementations already) as a proof of concept. Does
anybody have a better suggestion? I think Lua (or JS) by itself is
not
enough, there has to be a nice library of utility
functions. Has
anyone
thought about what that will really look like?
Also it would be great if Lua binding could perform parser functions. I
believe that Extension:WikiScripts uses parser frame and can use current
template parameters, when available:
http://www.mediawiki.org/wiki/Extension:WikiScripts
Template library (tpl_) allows the script to access the parser and the
parameters of the template that invokes the script.
tpl_arg( argname[, default] ) returns the argument which name is
specified as an argument, or the default value if it is not set (if no
default is specified, it returns false).
tpl_named_args() returns all the named arguments to the template.
tpl_numbered_args() returns all the numbered arguments.
tpl_is_transcluded() returns whether the code is invoked from a
template.
Dmitriy
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l