3 // Register mustache compiler
4 mw.template.registerCompiler( 'mustache', {
5 compile: function ( src ) {
9 * @return {string} The raw source code of the template
11 getSource: function () {
16 * @param {Object} data Data to render
17 * @param {Object} partialTemplates Map partial names to Mustache template objects
18 * returned by mw.template.get()
20 render: function ( data, partialTemplates ) {
22 if ( partialTemplates ) {
23 $.each( partialTemplates, function ( name, template ) {
24 partials[ name ] = template.getSource();
27 return $( $.parseHTML( Mustache.render( src, data, partials ) ) );
33 }( mediaWiki, jQuery ) );