mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi
synced 2024-11-15 02:24:07 +00:00
Fixup (and add) some braces, remove trailing whitespace
This commit is contained in:
parent
4bc3dbd009
commit
29de7361fb
|
@ -62,15 +62,19 @@ class SyntaxHighlight_GeSHi {
|
|||
// Highlighting specific lines
|
||||
if( isset( $args['highlight'] ) ) {
|
||||
$lines = self::parseHighlightLines( $args['highlight'] );
|
||||
if ( count($lines) ) $geshi->highlight_lines_extra( $lines );
|
||||
if ( count($lines) ) {
|
||||
$geshi->highlight_lines_extra( $lines );
|
||||
}
|
||||
}
|
||||
// Starting line number
|
||||
if( isset( $args['start'] ) )
|
||||
if( isset( $args['start'] ) ) {
|
||||
$geshi->start_line_numbers_at( $args['start'] );
|
||||
}
|
||||
$geshi->set_header_type( $enclose );
|
||||
// Strict mode
|
||||
if( isset( $args['strict'] ) )
|
||||
if( isset( $args['strict'] ) ) {
|
||||
$geshi->enable_strict_mode();
|
||||
}
|
||||
// Format
|
||||
$out = $geshi->parse_code();
|
||||
$err = $geshi->error();
|
||||
|
@ -209,8 +213,9 @@ class SyntaxHighlight_GeSHi {
|
|||
private static function prepare( $text, $lang ) {
|
||||
self::initialise();
|
||||
$geshi = new GeSHi( $text, $lang );
|
||||
if( $geshi->error() == GESHI_ERROR_NO_SUCH_LANG )
|
||||
if( $geshi->error() == GESHI_ERROR_NO_SUCH_LANG ) {
|
||||
return null;
|
||||
}
|
||||
$geshi->set_encoding( 'UTF-8' );
|
||||
$geshi->enable_classes();
|
||||
$geshi->set_overall_class( "source-$lang" );
|
||||
|
@ -255,8 +260,9 @@ class SyntaxHighlight_GeSHi {
|
|||
*/
|
||||
private static function formatError( $error = '' ) {
|
||||
$html = '';
|
||||
if( $error )
|
||||
if( $error ) {
|
||||
$html .= "<p>{$error}</p>";
|
||||
}
|
||||
$html .= '<p>' . htmlspecialchars( wfMsgForContent( 'syntaxhighlight-specify' ) )
|
||||
. ' <samp><source lang="html4strict">...</source></samp></p>'
|
||||
. '<p>' . htmlspecialchars( wfMsgForContent( 'syntaxhighlight-supported' ) ) . '</p>'
|
||||
|
@ -305,8 +311,9 @@ class SyntaxHighlight_GeSHi {
|
|||
private static function initialise() {
|
||||
if( !self::$initialised ) {
|
||||
wfLoadExtensionMessages( 'SyntaxHighlight_GeSHi' );
|
||||
if( !class_exists( 'GeSHi' ) )
|
||||
if( !class_exists( 'GeSHi' ) ) {
|
||||
require( 'geshi/geshi.php' );
|
||||
}
|
||||
self::$initialised = true;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
* some help text and a list of all supported languages.
|
||||
*/
|
||||
|
||||
if( !defined( 'MEDIAWIKI' ) )
|
||||
if( !defined( 'MEDIAWIKI' ) ) {
|
||||
die();
|
||||
}
|
||||
|
||||
$wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi'] = array(
|
||||
'path' => __FILE__,
|
||||
|
@ -57,8 +58,7 @@ $wgHooks['ParserFirstCallInit'][] = 'efSyntaxHighlight_GeSHiSetup';
|
|||
if ( version_compare( $wgVersion, '1.17alpha', '>=' ) ) {
|
||||
// For MediaWiki 1.17 alpha and later.
|
||||
$wgHooks['ExtensionTypes'][] = 'SyntaxHighlight_GeSHi::hSpecialVersion_GeSHi';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// For pre-MediaWiki 1.17 alpha.
|
||||
$wgHooks['SpecialVersionExtensionTypes'][] = 'SyntaxHighlight_GeSHi::hOldSpecialVersion_GeSHi';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue