jenkins-bot has submitted this change and it was merged.

Change subject: Use SyntaxHighlight_GeSHi::highlight() for syntax highlighting
......................................................................


Use SyntaxHighlight_GeSHi::highlight() for syntax highlighting

Instead of the backwards-compat GeSHi functions.

Depends upon Iae0cfb8380.

Bug: T71328
Change-Id: I38af92870599f703dfa783e4210fb3aebab3a616
---
M includes/JsonSchemaContent.php
1 file changed, 4 insertions(+), 5 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/JsonSchemaContent.php b/includes/JsonSchemaContent.php
index c075131..6f02553 100644
--- a/includes/JsonSchemaContent.php
+++ b/includes/JsonSchemaContent.php
@@ -156,21 +156,20 @@
                if ( $revId !== null && class_exists( 'SyntaxHighlight_GeSHi' ) 
) {
                        $html = '';
                        $highlighter = new SyntaxHighlight_GeSHi();
-                       foreach( self::getCodeSamples( $title->getDBkey(), 
$revId ) as $sample ) {
+                       foreach ( self::getCodeSamples( $title->getDBkey(), 
$revId ) as $sample ) {
                                $lang = $sample['language'];
                                $code = $sample['code'];
-                               $geshi = $highlighter->prepare( $code, $lang );
-                               $out->addHeadItem( $highlighter::buildHeadItem( 
$geshi ), "source-$lang" );
+                               $highlighted = $highlighter->highlight( $code, 
$lang )->getValue();
                                $html .= Html::element( 'h2',
                                        array(),
                                        wfMessage( $sample['header'] )->text()
-                               ) . $geshi->parse_code();
+                               ) . $highlighted;
                        }
                        // The glyph is '< >' from the icon font 'Entypo' (see 
../modules).
                        $html = Xml::tags( 'div', array( 'class' => 
'mw-json-schema-code-glyph' ), '&#xe714;' ) .
                                Xml::tags( 'div', array( 'class' => 
'mw-json-schema-code-samples' ), $html );
                        $out->setIndicator( 'schema-code-samples', $html );
-                       $out->addModules( 'ext.eventLogging.jsonSchema' );
+                       $out->addModules( array( 'ext.eventLogging.jsonSchema', 
'ext.pygments' ) );
                        $out->addModuleStyles( 
'ext.eventLogging.jsonSchema.styles' );
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/246261
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I38af92870599f703dfa783e4210fb3aebab3a616
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to