I don't know about scripting languages for the templating, it might be an overkill.
When I was picking lower language for MediaWiki Widgets extension, I looked at popular PHP templating systems and ended up picking Smarty ( http://smarty.net/) - it can be security locked, it has a few useful features.
You can see Widget code here: http://www.mediawikiwidgets.org/w/index.php?title=Widget:Google_Calendar&... widget is called using a parser function like this: {{widget: Name|param=val|param2=val2}}.
Double curlys are far from perfect, but there are not that many good alternatives - XML is probably the only good alternative because it's universal and use by many-many tools out there. Can't say that I'm an expert in templating languages though, especially when we're talking about power-users and not developers.
Thank you,
Sergey
-- Sergey Chernyshev http://www.sergeychernyshev.com/
On Tue, Jun 30, 2009 at 12:16 PM, Brion Vibber brion@wikimedia.org wrote:
As many folks have noted, our current templating system works ok for simple things, but doesn't scale well -- even moderately complex conditionals or text-munging will quickly turn your template source into what appears to be line noise.
And we all thought Perl was bad! ;)
There's been talk of Lua as an embedded templating language for a while, and there's even an extension implementation.
One advantage of Lua over other languages is that its implementation is optimized for use as an embedded language, and it looks kind of pretty.
An _inherent_ disadvantage is that it's a fairly rarely-used language, so still requires special learning on potential template programmers' part.
An _implementation_ disadvantage is that it currently is dependent on an external Lua binary installation -- something that probably won't be present on third-party installs, meaning Lua templates couldn't be easily copied to non-Wikimedia wikis.
There are perhaps three primary alternative contenders that don't involve making up our own scripting language (something I'd dearly like to avoid):
- PHP
Advantage: Lots of webbish people have some experience with PHP or can easily find references.
Advantage: we're pretty much guaranteed to have a PHP interpreter available. :)
Disadvantage: PHP is difficult to lock down for secure execution.
- JavaScript
Advantage: Even more folks have been exposed to JavaScript programming, including Wikipedia power-users.
Disadvantage: Server-side interpreter not guaranteed to be present. Like Lua, would either restrict our portability or would require an interpreter reimplementation. :P
- Python
Advantage: A Python interpreter will be present on most web servers, though not necessarily all. (Windows-based servers especially.)
Wash: Python is probably better known than Lua, but not as well as PHP or JS.
Disadvantage: Like PHP, Python is difficult to lock down securely.
Any thoughts? Does anybody happen to have a PHP implementation of a Lua or JavaScript interpreter? ;)
-- brion
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l