lib/mw/ApiRequest.js
function PreprocessorRequest(env, title, text, queueKey) {
	ApiRequest.call(this, env, title);
	this.queueKey = queueKey;
	this.text = text;
	this.reqType = "Template Expansion";

	var apiargs = {
		format: 'json',
		formatversion: 2,
		action: 'expandtemplates',
		prop: 'wikitext|categories|properties|modules|jsconfigvars',
		text: text,
	};

	// the empty string is an invalid title
	// default value is: API
	if (title) {
		apiargs.title = title;
	}

	if (env.page.meta.revision.revid) {
		apiargs.revid = env.page.meta.revision.revid;
	}

	this.requestOptions = {
		// Use POST since we are passing a bit of source, and GET has a very
		// limited length. You'll be greeted by "HTTP Error 414 Request URI
		// too long" otherwise ;)
		method: 'POST',
		form: apiargs, // The API arguments
		followRedirect: true,
		uri: env.conf.wiki.apiURI,
		timeout: env.conf.parsoid.timeouts.mwApi.preprocessor,
	};

	this.request(this.requestOptions);
}
function PreprocessorRequest(env, title, text, queueKey) {
	ApiRequest.call(this, env, title);
	this.queueKey = queueKey;
	this.text = text;
	this.reqType = "Template Expansion";

	var apiargs = {
		format: 'json',
		formatversion: 2,
		action: 'expandtemplates',
		prop: 'wikitext|categories|properties|modules|jsconfigvars',
		text: text,
	};

	// the empty string is an invalid title
	// default value is: API
	if (title) {
		apiargs.title = title;
	}

	if (env.page.meta.revision.revid) {
		apiargs.revid = env.page.meta.revision.revid;
	}

	this.requestOptions = {
		// Use POST since we are passing a bit of source, and GET has a very
		// limited length. You'll be greeted by "HTTP Error 414 Request URI
		// too long" otherwise ;)
		method: 'POST',
		form: apiargs, // The API arguments
		followRedirect: true,
		uri: env.conf.wiki.apiURI,
		timeout: env.conf.parsoid.timeouts.mwApi.preprocessor,
	};

	this.request(this.requestOptions);
}
function PreprocessorRequest ( env , title , text , queueKey ) { ApiRequest . call ( this , env , title ) ; this . queueKey = queueKey ; this . text = text ; this . reqType = "Template Expansion" ; var apiargs = { format : 'json' , formatversion : 2 , action : 'expandtemplates' , prop : 'wikitext|categories|properties|modules|jsconfigvars' , text : text , } ; // the empty string is an invalid title // default value is: API if ( title ) { apiargs . title = title ; } if ( env . page . meta . revision . revid ) { apiargs . revid = env . page . meta . revision . revid ; } this . requestOptions = { // Use POST since we are passing a bit of source, and GET has a very // limited length. You'll be greeted by "HTTP Error 414 Request URI // too long" otherwise ;) method : 'POST' , form : apiargs , // The API arguments followRedirect : true , uri : env . conf . wiki . apiURI , timeout : env . conf . parsoid . timeouts . mwApi . preprocessor , } ; this . request ( this . requestOptions ) ; }
Passes the source of a single preprocessor construct including its
parameters to action=expandtemplates.

@class
@extends ~ApiRequest
@param {MWParserEnvironment} env
@param {string} title The title of the page to use as the context.
@param {string} text
@param {string} queueKey The queue key.
Passes the source of a single preprocessor construct including its parameters to action = expandtemplates .