Wikia/app — pull request #787 by federico-lox (2013-05-12 21:27:43+00:00)
Title: Wikia Template System

Phase I: Implementation
==================

Overview
------------
As the need for generating HTML via templates is becoming more relevant outside of the scope of Nirvana, we need a way to manage PHP/Mustache templates in an easy, tested and centralized way.

So far this was achieved via __EasyTemplate__, but the implementation is really ancient and visibly optimized to render multiple templates from the same folder in the same run, which paradoxically is a case not found in our codebase.

Enters __Wikia Template System__, a reinterpretation of the same concept using more modern practices, it comes with unit, integration and performance tests :)

This is meant to replace EasyTempate (both the copies lurking in our repo) and WikiaView's template rendering code (which is a duplication of the same logic in EasyTemplate); see the __Next steps__ sections for more info.

Goals
--------
* Deliver an implementation using patterns more familiar to the current version of MW and of our codebase
* Utilizes PHP 5.4 syntax
* Implemented with Namespaces (uses the standard MW Autoloader for now, see changes to DefaultSettings.php)
* Fluent interface to shorten the amount of code required in different scenarios, this is a pattern used by both MW (Message class) and Wikia (Search)
* Minor performance improvements, the test and its results are available (here)[https://gist.github.com/federico-lox/5564884]
* Give the code structure while avoiding an increase in the complexity/depth or adding additional calls on the top of the stack when rendering, the code is not as DRY as it could but it has been dictated by this goal
* Test the hell out of it, there are both unit and integration tests

Next steps
--------------
* _Phase II_: Replace the usage of EasyTemplate in the codebase
* _Phase III_: Rework WikiaView to use the new system

@owend @Wyvek : please have a look and let the feedback flow ;)

@nandy-andy @kvas-damian @lukaszkonieczny @RafLeszczynski : this is what should be used in the FormBuilder code and be considered for the StyleGuide implementation

__WARNING__: Please do not merge, my devbox is not working ATM so I was able to only run the unit, integration and performance tests, I'll give it a full spin tomorrow.

Thanks.