Architecture Summit 2014/HTML templating

Subpage for the discussion of HTML templating at the summit.

HTML templating
Proposals that involve adding an abstraction layer for server-side and/or client-side HTML skin/user interface generation
 * Parsoid roadmap: DOM templating
 * Parsoid roadmap: DOM templating
 * Parsoid roadmap: DOM templating
 * Parsoid roadmap: DOM templating
 * Parsoid roadmap: DOM templating

Slide deck: https://docs.google.com/presentation/d/1bi5tddMFKVXJ0o1qMvBn_5kIzcbI_1IzkZMsLbOgY_E/edit?usp=sharing

Overview
The main focus of all of these RFCs is around HTML generation for user interface elements. This category is not about wikitext templates or anything to do with how we translate wikitext markup

"Template Engine" is Chris Steipp's submission outlining the use of Twig. From my conversations with Chris, it's not so much that he's eager to adopt Twig specifically so much as standardize on *something*, and make sure there's usage guidelines around it to avoid common mistakes. He's seen many attempts at per-extension template libraries that bloat our code and often start off with big security vulnerabilities. There are many extensions that use Twig, and it seems to be a popular choice for new work, so Chris is hoping to standardize on it and put some usage standards around it.

"HTML templating library" is Ryan Kaldari's submission, promoting the use of Mustache or something like it. His main motivation is to have a Javascript template library for front-end work, but is hoping we choose something that has both Javascript and PHP implementations so that any PHP template system implementation is compatible with what we use for Javascript templating.

"MVC Framework" is Owen Davis's description of Wikia's Nirvana framework, which has been central to all of the user-facing work they've been doing for the past 2-3 years. As Owen points out in the talk page for this, it's really view-controller rather than full MVC. A big plus of adopting this RFC is that it would make it much more likely that Wikia-developed extensions (of which there are many) would be of greater use to the larger MediaWiki community, and would generally help facilitate greater collaboration between Wikia and the rest of us.

"OutputPage Refactor" is another submission from Owen Davis, which isn't really about templating, so much as taking the HTML generation code out of OutputPage. Wikia has been maintaining a fork of OutputPage for quite some time, so they already have quite a bit of experience with the proposed changes. This is clustered with the templating proposals, since I imagine the work that gets factored out of OutputPage would need to be factored into whatever templating system we choose.

The Parsoid team is working on HTML templating for content, UI and messages. The security requirements are basically the same as those discussed in Chris' "Template Engine" RFC, with an emphasis on automatic contextual sanitization of user input to avoid issues like XSS. AngularJS is the current front-runner for an implementation starting point.

The first three seem somewhat mutually exclusive, though it's clear our task is likely to come up with a fourth proposal that incorporates many requirements of those three. The Parsoid work shoots for a long-term solution, but is just starting and initially focusing on JS. The OutputPage Refactor proposal, given some fleshing out, may not be controversial at all.

Big Questions

 * What aspects of performance are important in this conversation, and just how important are they?
 * What features should we generally avoid in templating languages?
 * What features are essential?
 * Is Javascript/PHP compatibility important? If we don't pursue a dual strategy, is it more important to tackle PHP or Javascript first?
 * Is template inheritance important?
 * Do we want to consider opening up templating to on-wiki use, or just developers?
 * How important is existing usage? How entrenched are any incumbents?
 * How should we arrive a decision?

Agenda
Etherpad: https://etherpad.wikimedia.org/p/html_templating
 * 5-20 minutes - various lightning talks about the different proposals on the table
 * 40-60 minutes - discussion of big questions