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()
19 * @return {jQuery} Rendered HTML
21 render: function ( data
, partialTemplates
) {
23 if ( partialTemplates
) {
24 $.each( partialTemplates
, function ( name
, template
) {
25 partials
[ name
] = template
.getSource();
28 return $( $.parseHTML( Mustache
.render( src
, data
, partials
) ) );
34 }( mediaWiki
, jQuery
) );