r108171 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108170‎ | r108171 | r108172 >
Date:19:46, 5 January 2012
Author:robin
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php
@@ -117,12 +117,9 @@
118118 if ( $enclose === GESHI_HEADER_NONE ) {
119119 $attribs = self::addAttribute( $attribs, 'class', 'mw-geshi ' . $lang . ' source-' . $lang );
120120 } else {
121 - if ( !isset( $attribs['dir'] ) ) {
122 - $attribs = self::addAttribute( $attribs, 'dir', 'ltr' );
123 - }
124 -
125 - $attribs = self::addAttribute( $attribs, 'class', 'mw-geshi' );
126 - $attribs = self::addAttribute( $attribs, 'style', 'text-align: left;' );
 121+ // Default dir="ltr" (but allow dir="rtl", although unsure if needed)
 122+ $attribs['dir'] = isset( $attribs['dir'] ) && $attribs['dir'] === 'rtl' ? 'rtl' : 'ltr';
 123+ $attribs = self::addAttribute( $attribs, 'class', 'mw-geshi mw-content-' . $attribs['dir'] );
127124 }
128125 $out = Xml::tags( $encloseTag, $attribs, $out );
129126

Status & tagging log