From b81f422ffc9c4ec5b38a436d48e9982f03d67a1f Mon Sep 17 00:00:00 2001 From: Robin Pepermans Date: Thu, 5 Jan 2012 19:46:42 +0000 Subject: [PATCH] Add mw-content-ltr/rtl class: fixes bug 33538: Line numbers are outside of left border when using 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 tag. --- SyntaxHighlight_GeSHi.class.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/SyntaxHighlight_GeSHi.class.php b/SyntaxHighlight_GeSHi.class.php index 8b3fb50c..a6f7cee4 100644 --- a/SyntaxHighlight_GeSHi.class.php +++ b/SyntaxHighlight_GeSHi.class.php @@ -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 );