Add Option to Enable Keyword Links

Patch by Bryan Petty

Bug: 53787
Change-Id: I8c818859df8240cfcfef94d06d5d12a848cc76dc
This commit is contained in:
Bryan Petty 2013-09-05 17:31:53 +01:00 committed by Reedy
parent 32f2019420
commit cd001a9ed9
2 changed files with 8 additions and 2 deletions

View file

@ -327,6 +327,9 @@ class SyntaxHighlight_GeSHi {
* @return GeSHi
*/
public static function prepare( $text, $lang ) {
global $wgSyntaxHighlightKeywordLinks;
self::initialise();
$geshi = new GeSHi( $text, $lang );
if( $geshi->error() == GESHI_ERROR_NO_SUCH_LANG ) {
@ -335,7 +338,7 @@ class SyntaxHighlight_GeSHi {
$geshi->set_encoding( 'UTF-8' );
$geshi->enable_classes();
$geshi->set_overall_class( "source-$lang" );
$geshi->enable_keyword_links( false );
$geshi->enable_keyword_links( $wgSyntaxHighlightKeywordLinks );
// If the source code is over 100 kB, disable higlighting of symbols.
// If over 200 kB, disable highlighting of strings too.

View file

@ -48,7 +48,10 @@ $wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi'] = array(
'url' => 'https://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi',
);
$wgSyntaxHighlightDefaultLang = null; //Change this in LocalSettings.php
// Change these in LocalSettings.php
$wgSyntaxHighlightDefaultLang = null;
$wgSyntaxHighlightKeywordLinks = false;
$dir = dirname(__FILE__) . '/';
$wgExtensionMessagesFiles['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.i18n.php';
$wgAutoloadClasses['SyntaxHighlight_GeSHi'] = $dir . 'SyntaxHighlight_GeSHi.class.php';