Use CSS classes .mw-code and .mw-code-inline

- Follows-up I4ff5d0197ba8dc0dad3cafd03f2b120bc22e75cb

- Reverts r113190 (redundant fix that caused 35875)

- Fixes:
 * bug 19416
 * bug 35875

Change-Id: Iaa2227348ca632d4a261c149bdf2428b4b48adc7
This commit is contained in:
Timo Tijhof 2012-04-14 06:08:20 +02:00
parent 43764e342c
commit dc147a5ef1

View file

@ -105,24 +105,24 @@ class SyntaxHighlight_GeSHi {
// Register CSS // Register CSS
$parser->getOutput()->addHeadItem( self::buildHeadItem( $geshi ), "source-{$lang}" ); $parser->getOutput()->addHeadItem( self::buildHeadItem( $geshi ), "source-{$lang}" );
if( $wgUseSiteCss ) { if ( $wgUseSiteCss ) {
$parser->getOutput()->addModuleStyles( 'ext.geshi.local' ); $parser->getOutput()->addModuleStyles( 'ext.geshi.local' );
} }
$encloseTag = $enclose === GESHI_HEADER_NONE ? 'code' : 'pre'; $encloseTag = $enclose === GESHI_HEADER_NONE ? 'span' : 'div';
$attribs = Sanitizer::validateTagAttributes( $args, $encloseTag ); $attribs = Sanitizer::validateTagAttributes( $args, $encloseTag );
//lang is valid in HTML context, but also used on GeSHi //lang is valid in HTML context, but also used on GeSHi
unset( $attribs['lang'] ); unset( $attribs['lang'] );
if ( $enclose === GESHI_HEADER_NONE ) { if ( $enclose === GESHI_HEADER_NONE ) {
$attribs = self::addAttribute( $attribs, 'class', 'mw-geshi ' . $lang . ' source-' . $lang ); $attribs = self::addAttribute( $attribs, 'class', 'mw-geshi mw-code-inline ' . $lang . ' source-' . $lang );
} else { } else {
// Default dir="ltr" (but allow dir="rtl", although unsure if needed) // Default dir="ltr" (but allow dir="rtl", although unsure if needed)
$attribs['dir'] = isset( $attribs['dir'] ) && $attribs['dir'] === 'rtl' ? 'rtl' : 'ltr'; $attribs['dir'] = isset( $attribs['dir'] ) && $attribs['dir'] === 'rtl' ? 'rtl' : 'ltr';
$attribs = self::addAttribute( $attribs, 'class', 'mw-geshi mw-content-' . $attribs['dir'] ); $attribs = self::addAttribute( $attribs, 'class', 'mw-geshi mw-code mw-content-' . $attribs['dir'] );
} }
$out = Xml::tags( $encloseTag, $attribs, $out ); $out = Html::rawElement( $encloseTag, $attribs, $out );
wfProfileOut( __METHOD__ ); wfProfileOut( __METHOD__ );
return $out; return $out;