Scribunto: Why and how MediaWiki integrated Lua for templating

*
Proposal
Short Form
Intermediate

Excerpt

The Scribunto ("They shall write") extension for MediaWiki allows wiki users to write Lua code to process and display text and data in articles. Learn why Wikimedia chose Lua, how it is integrated into our PHP-based web app, and what results have been seen since the deployment in March.

Description

MediaWiki, the software behind Wikipedia, has long had “templates” which allow for content to be more readily formatted and included in multiple articles. And it has long had markup for simple conditionals, calculations, and extremely basic text processing known as “parser functions”. On this base, Wikipedia’s users have built some incredibly complex templates in wiki markup. Over time, unfortunately, those complex templates got unusably hard to read and edit, and badly affected our site performance.

Rather than continue to extend the inefficient and near-illegible parser functions with more complex methods and control structures, Wikimedia decided to embed a real programming language for text processing. Candidates included JavaScript and a home-grown scripting language, but in the end, Lua won out. We wrote code, we created test installations and an in-wiki “sandbox” for template testing, and a little over a year later, we deployed Scribunto to all Wikimedia Foundation wikis.

Brad, who worked on Scribunto and supporting libraries and editor tools, will talk about why the old parser functions needed to be replaced (warning: you will be amazed at what our editors had to put up with), why Lua was chosen, our constraints and design decisions, how the Scribunto extension interfaces MediaWiki (written in PHP) with Lua, and what results we’ve seen from our communities in the months since full deployment. You’ll also see an example conversion and hear about upcoming features, plans, and hopes.

Speaking experience

I've spoken about Scribunto and Lua a few times to Wikimedia staffers and developers; I gave a ten-minute presentation at a tech talk in February <https://www.youtube.com/watch?v=3UPDzPBf4t8&t=29m20s>, and was one of the presenters in an hourlong presentation in March that had about 50 attendees <https://www.youtube.com/watch?v=PrhzAtC8fCc&t=16m10s>. In May I will lead a hands-on tutorial for Wikimedia community members to help them convert old templates into Lua modules and invocations. If OSB accepts this proposal, it will be my first large conference talk.

Speaker

  • Brad jorsch 3

    Brad Jorsch

    Wikimedia Foundation

    Biography

    Brad has been an open source developer since the early 2000s, a MediaWiki developer since 2007 or 2008, and has worked for the Wikimedia Foundation since 2012.