mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi
synced 2024-11-27 15:50:37 +00:00
Replace deprecated MWException
Bug: T328220 Change-Id: Iaf4a9bb4aafc741395d5ccc5a42c6a72b5d42b99
This commit is contained in:
parent
81f673bc6d
commit
52ac696e25
|
@ -24,10 +24,10 @@ use FormatJson;
|
||||||
use Html;
|
use Html;
|
||||||
use IContextSource;
|
use IContextSource;
|
||||||
use MediaWiki\MediaWikiServices;
|
use MediaWiki\MediaWikiServices;
|
||||||
use MWException;
|
|
||||||
use Parser;
|
use Parser;
|
||||||
use ParserOptions;
|
use ParserOptions;
|
||||||
use ParserOutput;
|
use ParserOutput;
|
||||||
|
use RuntimeException;
|
||||||
use Sanitizer;
|
use Sanitizer;
|
||||||
use Status;
|
use Status;
|
||||||
use TextContent;
|
use TextContent;
|
||||||
|
@ -126,7 +126,6 @@ class SyntaxHighlight extends ExtensionTagHandler {
|
||||||
* @param array $args
|
* @param array $args
|
||||||
* @param Parser $parser
|
* @param Parser $parser
|
||||||
* @return string
|
* @return string
|
||||||
* @throws MWException
|
|
||||||
*/
|
*/
|
||||||
public static function parserHookSource( $text, $args, $parser ) {
|
public static function parserHookSource( $text, $args, $parser ) {
|
||||||
$parser->addTrackingCategory( 'syntaxhighlight-source-category' );
|
$parser->addTrackingCategory( 'syntaxhighlight-source-category' );
|
||||||
|
@ -146,7 +145,6 @@ class SyntaxHighlight extends ExtensionTagHandler {
|
||||||
* @param array $args
|
* @param array $args
|
||||||
* @param ?Parser $parser
|
* @param ?Parser $parser
|
||||||
* @return array
|
* @return array
|
||||||
* @throws MWException
|
|
||||||
*/
|
*/
|
||||||
private static function processContent( string $text, array $args, ?Parser $parser = null ): array {
|
private static function processContent( string $text, array $args, ?Parser $parser = null ): array {
|
||||||
// Don't trim leading spaces away, just the linefeeds
|
// Don't trim leading spaces away, just the linefeeds
|
||||||
|
@ -179,7 +177,6 @@ class SyntaxHighlight extends ExtensionTagHandler {
|
||||||
* @param array $args
|
* @param array $args
|
||||||
* @param Parser $parser
|
* @param Parser $parser
|
||||||
* @return string
|
* @return string
|
||||||
* @throws MWException
|
|
||||||
*/
|
*/
|
||||||
public static function parserHook( $text, $args, $parser ) {
|
public static function parserHook( $text, $args, $parser ) {
|
||||||
// Replace strip markers (For e.g. {{#tag:syntaxhighlight|<nowiki>...}})
|
// Replace strip markers (For e.g. {{#tag:syntaxhighlight|<nowiki>...}})
|
||||||
|
@ -226,7 +223,7 @@ class SyntaxHighlight extends ExtensionTagHandler {
|
||||||
if ( preg_match( '/^<div class="?mw-highlight"?>(.*)<\/div>$/s', trim( $out ), $m ) ) {
|
if ( preg_match( '/^<div class="?mw-highlight"?>(.*)<\/div>$/s', trim( $out ), $m ) ) {
|
||||||
$out = trim( $m[1] );
|
$out = trim( $m[1] );
|
||||||
} else {
|
} else {
|
||||||
throw new MWException( 'Unexpected output from Pygments encountered' );
|
throw new RuntimeException( 'Unexpected output from Pygments encountered' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
|
|
Loading…
Reference in a new issue