Add mw-content-ltr/rtl class: fixes bug 33538: Line numbers are outside of left border when using <source ... line start= > on RTL wikis

Also make sure mw-content-ltr/rtl is the same as the dir attribute value. Restrict that value to either ltr or rtl (not sure if rtl really needed; source code is always ltr). Also remove text-align:left; as it can/should be set manually in the <source> tag.
This commit is contained in:
Robin Pepermans 2012-01-05 19:46:42 +00:00
parent beba10969a
commit b81f422ffc

View file

@ -117,12 +117,9 @@ class SyntaxHighlight_GeSHi {
if ( $enclose === GESHI_HEADER_NONE ) {
$attribs = self::addAttribute( $attribs, 'class', 'mw-geshi ' . $lang . ' source-' . $lang );
} else {
if ( !isset( $attribs['dir'] ) ) {
$attribs = self::addAttribute( $attribs, 'dir', 'ltr' );
}
$attribs = self::addAttribute( $attribs, 'class', 'mw-geshi' );
$attribs = self::addAttribute( $attribs, 'style', 'text-align: left;' );
// Default dir="ltr" (but allow dir="rtl", although unsure if needed)
$attribs['dir'] = isset( $attribs['dir'] ) && $attribs['dir'] === 'rtl' ? 'rtl' : 'ltr';
$attribs = self::addAttribute( $attribs, 'class', 'mw-geshi mw-content-' . $attribs['dir'] );
}
$out = Xml::tags( $encloseTag, $attribs, $out );