https://www.mediawiki.org/wiki/Special:Code/MediaWiki/109748
Revision: 109748 Author: gwicke Date: 2012-01-22 19:32:28 +0000 (Sun, 22 Jan 2012) Log Message: ----------- A few parser function fixes and maximum template expansion in environment config. Modified Paths: -------------- trunk/extensions/VisualEditor/modules/parser/ext.core.TemplateHandler.js trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformManager.js trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.environment.js trunk/extensions/VisualEditor/modules/parser/parse.js Modified: trunk/extensions/VisualEditor/modules/parser/ext.core.TemplateHandler.js =================================================================== --- trunk/extensions/VisualEditor/modules/parser/ext.core.TemplateHandler.js 2012-01-22 19:22:44 UTC (rev 109747) +++ trunk/extensions/VisualEditor/modules/parser/ext.core.TemplateHandler.js 2012-01-22 19:32:28 UTC (rev 109748) @@ -189,7 +189,7 @@ // now normalize the target before template processing target = this.manager.env.normalizeTitle( target ); - var checkRes = this.manager.loopAndDepthCheck.check( target ); + var checkRes = this.manager.loopAndDepthCheck.check( target, this.manager.env.maxDepth ); if( checkRes ) { // Loop detected or depth limit exceeded, abort! res = [ Modified: trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformManager.js =================================================================== --- trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformManager.js 2012-01-22 19:22:44 UTC (rev 109747) +++ trunk/extensions/VisualEditor/modules/parser/mediawiki.TokenTransformManager.js 2012-01-22 19:32:28 UTC (rev 109748) @@ -959,9 +959,9 @@ * @method * @param {String} Title to check. */ -LoopAndDepthCheck.prototype.check = function ( title ) { +LoopAndDepthCheck.prototype.check = function ( title, maxDepth ) { // XXX: set limit really low for testing! - if ( this.depth > 40 ) { + if ( this.depth > maxDepth ) { // too deep //console.log( 'Loopcheck: ' + JSON.stringify( this, null, 2 ) ); return 'Error: Expansion depth limit exceeded at '; Modified: trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.environment.js =================================================================== --- trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.environment.js 2012-01-22 19:22:44 UTC (rev 109747) +++ trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.environment.js 2012-01-22 19:32:28 UTC (rev 109748) @@ -6,7 +6,8 @@ debug: false, wgScriptPath: "http://en.wikipedia.org/w", wgScriptExtension: ".php", - fetchTemplates: false + fetchTemplates: false, + maxDepth: 40 }; $.extend(options, opts); $.extend(this, options); Modified: trunk/extensions/VisualEditor/modules/parser/parse.js =================================================================== --- trunk/extensions/VisualEditor/modules/parser/parse.js 2012-01-22 19:22:44 UTC (rev 109747) +++ trunk/extensions/VisualEditor/modules/parser/parse.js 2012-01-22 19:32:28 UTC (rev 109748) @@ -22,6 +22,11 @@ description: 'Debug mode', 'boolean': true, 'default': false + }, + 'maxdepth': { + description: 'Maximum expansion depth', + 'boolean': false, + 'default': 40 } }).argv; @@ -32,7 +37,8 @@ wgScriptExtension: ".php", fetchTemplates: true, // enable/disable debug output using this switch - debug: argv.debug + debug: argv.debug, + maxDepth: argv.maxdepth } ), parser = new ParserPipeline( env ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs