jenkins-bot has submitted this change and it was merged.
Change subject: Use ContentGetParserOutput hook instead of ShowRawCssJs
......................................................................
Use ContentGetParserOutput hook instead of ShowRawCssJs
Depends on I58679856 in core MediaWiki.
This breaks compatibility with MW < 1.24.
Bug: 64859
Change-Id: Idf4ad4397101a4d19be2ac773cd4bad52188d903
---
M SyntaxHighlight_GeSHi.class.php
M SyntaxHighlight_GeSHi.php
2 files changed, 5 insertions(+), 44 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/SyntaxHighlight_GeSHi.class.php b/SyntaxHighlight_GeSHi.class.php
index 4c31fbe..e816492 100644
--- a/SyntaxHighlight_GeSHi.class.php
+++ b/SyntaxHighlight_GeSHi.class.php
@@ -230,41 +230,6 @@
}
/**
- * Hook into Article::view() to provide syntax highlighting for
- * custom CSS and JavaScript pages.
- *
- * B/C for MW 1.20 and before. 1.21 and later use renderHook() instead.
- *
- * @param string $text
- * @param Title $title
- * @param OutputPage $output
- * @return bool
- */
- public static function viewHook( $text, $title, $output ) {
- global $wgUseSiteCss;
- // Determine the language
- $matches = array();
- preg_match( '!\.(css|js)$!u', $title->getText(), $matches );
- $lang = isset( $matches[1] ) && $matches[1] == 'css' ? 'css' :
'javascript';
- // Attempt to format
- $geshi = self::prepare( $text, $lang );
- if( $geshi instanceof GeSHi ) {
- $out = $geshi->parse_code();
- if( !$geshi->error() ) {
- // Done
- $output->addHeadItem( "source-$lang",
self::buildHeadItem( $geshi ) );
- $output->addHTML( "<div
dir=\"ltr\">{$out}</div>" );
- if( $wgUseSiteCss ) {
- $output->addModuleStyles(
'ext.geshi.local' );
- }
- return false;
- }
- }
- // Bottle out
- return true;
- }
-
- /**
* Hook into Content::getParserOutput to provide syntax highlighting for
* script content.
*
@@ -272,7 +237,7 @@
* @since MW 1.21
*/
public static function renderHook( Content $content, Title $title,
- ParserOptions $options, $generateHtml, ParserOutput
&$output
+ $revId, ParserOptions $options, $generateHtml,
ParserOutput &$output
) {
global $wgSyntaxHighlightModels, $wgUseSiteCss;
@@ -382,11 +347,14 @@
* Prepare a CSS snippet suitable for use as a ParserOutput/OutputPage
* head item.
*
+ * Not used anymore, kept for backwards-compatibility with other
extensions.
+ *
* @deprecated
* @param GeSHi $geshi
* @return string
*/
public static function buildHeadItem( $geshi ) {
+ wfDeprecated( __METHOD__ );
$css = array();
$css[] = '<style type="text/css">/*<![CDATA[*/';
$css[] = self::getCSS( $geshi );
diff --git a/SyntaxHighlight_GeSHi.php b/SyntaxHighlight_GeSHi.php
index a179e3b..da33ebe 100644
--- a/SyntaxHighlight_GeSHi.php
+++ b/SyntaxHighlight_GeSHi.php
@@ -58,14 +58,7 @@
$wgHooks['ExtensionTypes'][] = 'SyntaxHighlight_GeSHi::extensionTypes';
$wgHooks['ResourceLoaderRegisterModules'][] =
'SyntaxHighlight_GeSHi::resourceLoaderRegisterModules';
-
-//if ( defined( 'MW_SUPPORTS_CONTENTHANDLER' ) ) {
- // since MW 1.21
-// $wgHooks['ContentGetParserOutput'][] =
'SyntaxHighlight_GeSHi::renderHook';
-//} else {
- // B/C until 1.20
- $wgHooks['ShowRawCssJs'][] = 'SyntaxHighlight_GeSHi::viewHook';
-//}
+$wgHooks['ContentGetParserOutput'][] = 'SyntaxHighlight_GeSHi::renderHook';
// Module to load MediaWiki:Geshi.css.
$wgResourceModules['ext.geshi.local'] = array( 'class' =>
'ResourceLoaderGeSHiLocalModule' );
--
To view, visit https://gerrit.wikimedia.org/r/131447
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idf4ad4397101a4d19be2ac773cd4bad52188d903
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/SyntaxHighlight_GeSHi
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits