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 for ( const name in partialTemplates ) {
25 const template = partialTemplates[ name ];
26 partials[ name ] = template.getSource();
29 return $( $.parseHTML( Mustache.render( src, data, partials ) ) );