Add countUnreadNotifications to WatchedItemStore
[lhc/web/wiklou.git] / resources / src / mediawiki / api / parse.js
1 /**
2 * @class mw.Api.plugin.parse
3 */
4 ( function ( mw, $ ) {
5
6 $.extend( mw.Api.prototype, {
7 /**
8 * Convenience method for 'action=parse'.
9 *
10 * @param {string} wikitext
11 * @return {jQuery.Promise}
12 * @return {Function} return.done
13 * @return {string} return.done.data Parsed HTML of `wikitext`.
14 */
15 parse: function ( wikitext ) {
16 var apiPromise = this.get( {
17 formatversion: 2,
18 action: 'parse',
19 contentmodel: 'wikitext',
20 text: wikitext
21 } );
22
23 return apiPromise
24 .then( function ( data ) {
25 return data.parse.text;
26 } )
27 .promise( { abort: apiPromise.abort } );
28 }
29 } );
30
31 /**
32 * @class mw.Api
33 * @mixins mw.Api.plugin.parse
34 */
35
36 }( mediaWiki, jQuery ) );