mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 06:54:00 +00:00
Merge "Rename CiteParserTagHooks::initialize to register"
This commit is contained in:
commit
0dafe64305
|
@ -18,7 +18,7 @@ class CiteParserHooks {
|
|||
*/
|
||||
public static function onParserFirstCallInit( Parser $parser ) {
|
||||
$parser->extCite = new Cite();
|
||||
CiteParserTagHooks::initialize( $parser );
|
||||
CiteParserTagHooks::register( $parser );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ class CiteParserHooks {
|
|||
$cite = $parser->extCite;
|
||||
$cite->clearState( 'force' );
|
||||
|
||||
CiteParserTagHooks::initialize( $parser );
|
||||
CiteParserTagHooks::register( $parser );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,9 +16,9 @@ class CiteParserTagHooks {
|
|||
*
|
||||
* @param Parser $parser
|
||||
*/
|
||||
public static function initialize( Parser $parser ) {
|
||||
$parser->setHook( 'ref', __CLASS__ . '::ref' );
|
||||
$parser->setHook( 'references', __CLASS__ . '::references' );
|
||||
public static function register( Parser $parser ) {
|
||||
$parser->setHook( 'ref', [ __CLASS__, 'ref' ] );
|
||||
$parser->setHook( 'references', [ __CLASS__, 'references' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,6 @@ class CiteParserTagHooks {
|
|||
public static function ref( $content, array $attributes, Parser $parser, PPFrame $frame ) {
|
||||
/** @var Cite $cite */
|
||||
$cite = $parser->extCite;
|
||||
// @phan-suppress-next-line SecurityCheck-XSS False positive
|
||||
$result = $cite->ref( $content, $attributes, $parser );
|
||||
|
||||
if ( $result === false ) {
|
||||
|
@ -46,6 +45,7 @@ class CiteParserTagHooks {
|
|||
$parserOutput->addModuleStyles( 'ext.cite.styles' );
|
||||
|
||||
$frame->setVolatile();
|
||||
// @phan-suppress-next-line SecurityCheck-XSS False positive
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,6 @@ class CiteParserTagHooks {
|
|||
public static function references( $content, array $attributes, Parser $parser, PPFrame $frame ) {
|
||||
/** @var Cite $cite */
|
||||
$cite = $parser->extCite;
|
||||
// @phan-suppress-next-line SecurityCheck-XSS False positive
|
||||
$result = $cite->references( $content, $attributes, $parser );
|
||||
|
||||
if ( $result === false ) {
|
||||
|
@ -73,6 +72,7 @@ class CiteParserTagHooks {
|
|||
}
|
||||
|
||||
$frame->setVolatile();
|
||||
// @phan-suppress-next-line SecurityCheck-XSS False positive
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ use PPFrame;
|
|||
class CiteParserTagHooksTest extends \MediaWikiUnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::initialize
|
||||
* @covers ::register
|
||||
*/
|
||||
public function testInitialize() {
|
||||
public function testRegister() {
|
||||
$parser = $this->createMock( Parser::class );
|
||||
$parser->expects( $this->exactly( 2 ) )
|
||||
->method( 'setHook' )
|
||||
|
@ -27,7 +27,7 @@ class CiteParserTagHooksTest extends \MediaWikiUnitTestCase {
|
|||
[ 'references', $this->isType( 'callable' ) ]
|
||||
);
|
||||
|
||||
CiteParserTagHooks::initialize( $parser );
|
||||
CiteParserTagHooks::register( $parser );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue