* Merged replaceFreeExternalLinks() with doMagicLinks(). Makes a lot of sense, very similar operations, doesn't break any parser tests. Stops free links from interacting with other parser stages, the same way ISBN links don't. * The pass order change fixes Brion's complaint in r39980. Early link expansion, triggered by having more than 1000 links in the page, was outputting URLs which were destroyed by RFEL. Added parser test. * Fixed an unrelated bug in LinkHolderArray::replace(): if a link to a redirect appears in two separate RLH calls, the second and subsequent calls do not add the mw-redirect class. Caused by an unmigrated LinkCache fetch. * Added a parser test for a pass interaction bug that the pass order change fixes. * The fuzzer told me to tell you that free external links in non-caption image parameters, which are and have always been invisible, are now not registered either. * Miscellaneous supporting updates to the test infrastructure.
47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
if ( ! defined( 'MEDIAWIKI' ) )
|
|
die( -1 );
|
|
/**
|
|
* A basic extension that's used by the parser tests to test whether the parser
|
|
* calls extensions when they're called inside comments, it shouldn't do that
|
|
*
|
|
* @file
|
|
* @ingroup Maintenance
|
|
*
|
|
* @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
|
|
* @copyright Copyright © 2005, 2006 Ævar Arnfjörð Bjarmason
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
|
|
*/
|
|
|
|
$wgHooks['ParserTestParser'][] = 'wfParserTestStaticParserHookSetup';
|
|
|
|
function wfParserTestStaticParserHookSetup( &$parser ) {
|
|
$parser->setHook( 'statictag', 'wfParserTestStaticParserHookHook' );
|
|
|
|
return true;
|
|
}
|
|
|
|
function wfParserTestStaticParserHookHook( $in, $argv, $parser ) {
|
|
if ( ! count( $argv ) ) {
|
|
$parser->static_tag_buf = $in;
|
|
return '';
|
|
} else if ( count( $argv ) === 1 && isset( $argv['action'] )
|
|
&& $argv['action'] === 'flush' && $in === null )
|
|
{
|
|
// Clear the buffer, we probably don't need to
|
|
if ( isset( $parser->static_tag_buf ) ) {
|
|
$tmp = $parser->static_tag_buf;
|
|
} else {
|
|
$tmp = '';
|
|
}
|
|
$parser->static_tag_buf = null;
|
|
return $tmp;
|
|
} else
|
|
// wtf?
|
|
return
|
|
"\nCall this extension as <statictag>string</statictag> or as" .
|
|
" <statictag action=flush/>, not in any other way.\n" .
|
|
"text: " . var_export( $in, true ) . "\n" .
|
|
"argv: " . var_export( $argv, true ) . "\n";
|
|
}
|
|
|