mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi
synced 2024-11-23 22:13:40 +00:00
Passing a string to ParserOutput::addModules()/addModuleStyles() is deprecated
Bug: T296123 Change-Id: If14866f76703aa62d33e197bb18a5eacde7a55c0
This commit is contained in:
parent
fa5151d287
commit
e0cece9bc6
|
@ -138,7 +138,7 @@ class SyntaxHighlight {
|
||||||
// Register CSS
|
// Register CSS
|
||||||
// TODO: Consider moving to a separate method so that public method
|
// TODO: Consider moving to a separate method so that public method
|
||||||
// highlight() can be used without needing to know the module name.
|
// highlight() can be used without needing to know the module name.
|
||||||
$parser->getOutput()->addModuleStyles( 'ext.pygments' );
|
$parser->getOutput()->addModuleStyles( [ 'ext.pygments' ] );
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
@ -466,12 +466,12 @@ class SyntaxHighlight {
|
||||||
* @param int $revId
|
* @param int $revId
|
||||||
* @param ParserOptions $options
|
* @param ParserOptions $options
|
||||||
* @param bool $generateHtml
|
* @param bool $generateHtml
|
||||||
* @param ParserOutput &$output
|
* @param ParserOutput &$parserOutput
|
||||||
* @return bool
|
* @return bool
|
||||||
* @since MW 1.21
|
* @since MW 1.21
|
||||||
*/
|
*/
|
||||||
public static function onContentGetParserOutput( Content $content, Title $title,
|
public static function onContentGetParserOutput( Content $content, Title $title,
|
||||||
$revId, ParserOptions $options, $generateHtml, ParserOutput &$output
|
$revId, ParserOptions $options, $generateHtml, ParserOutput &$parserOutput
|
||||||
) {
|
) {
|
||||||
global $wgTextModelsToParse;
|
global $wgTextModelsToParse;
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ class SyntaxHighlight {
|
||||||
// Parse using the standard parser to get links etc. into the database, HTML is replaced below.
|
// Parse using the standard parser to get links etc. into the database, HTML is replaced below.
|
||||||
// We could do this using $content->fillParserOutput(), but alas it is 'protected'.
|
// We could do this using $content->fillParserOutput(), but alas it is 'protected'.
|
||||||
if ( in_array( $model, $wgTextModelsToParse ) ) {
|
if ( in_array( $model, $wgTextModelsToParse ) ) {
|
||||||
$output = MediaWikiServices::getInstance()->getParser()
|
$parserOutput = MediaWikiServices::getInstance()->getParser()
|
||||||
->parse( $text, $title, $options, true, true, $revId );
|
->parse( $text, $title, $options, true, true, $revId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,9 +515,9 @@ class SyntaxHighlight {
|
||||||
}
|
}
|
||||||
$out = $status->getValue();
|
$out = $status->getValue();
|
||||||
|
|
||||||
$output->addModuleStyles( 'ext.pygments' );
|
$parserOutput->addModuleStyles( [ 'ext.pygments' ] );
|
||||||
$output->addModules( 'ext.pygments.linenumbers' );
|
$parserOutput->addModules( [ 'ext.pygments.linenumbers' ] );
|
||||||
$output->setText( $out );
|
$parserOutput->setText( $out );
|
||||||
|
|
||||||
// Inform MediaWiki that we have parsed this page and it shouldn't mess with it.
|
// Inform MediaWiki that we have parsed this page and it shouldn't mess with it.
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue