(bug 28430) Make HTML and TeX output of <math> tags be LTR always
authorBrian Wolff <bawolff@users.mediawiki.org>
Tue, 5 Apr 2011 19:51:22 +0000 (19:51 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Tue, 5 Apr 2011 19:51:22 +0000 (19:51 +0000)
The PNG output of <math> is always LTR regardless of content language,
and since we switch back and forth between PNG/html depending on
how complicated the formula is, we should be consistent. Also according to
the bug always doing LTR even on RTL langs is appearently correct behaviour.

Also change for plain TeX output to be LTR, as otherwise the TeX commands
don't really make sense if $ ^{355} $ gets turned into $ {355}^ $

RELEASE-NOTES
includes/Math.php

index af3a1da..b2f62d8 100644 (file)
@@ -225,6 +225,7 @@ PHP if you have not done so prior to upgrading MediaWiki.
 * (bug 28417) Fix PHP notice when importing revision without a listed id
 * (bug 28394) Set forgotten parameters types in ApiUnblock
 * (bug 28395) Set forgotten parameters types in ApiParse
+* (bug 28430) Make html and TeX output of <math> always be left-to-right.
 
 === API changes in 1.18 ===
 * (bug 26339) Throw warning when truncating an overlarge API result
index 0e136d5..c9be6f4 100644 (file)
@@ -38,7 +38,7 @@ class MathRenderer {
                if( $this->mode == MW_MATH_SOURCE ) {
                        # No need to render or parse anything more!
                        # New lines are replaced with spaces, which avoids confusing our parser (bugs 23190, 22818)
-                       return ('<span class="tex">$ ' . str_replace( "\n", " ", htmlspecialchars( $this->tex ) ) . ' $</span>');
+                       return ('<span class="tex" dir="ltr">$ ' . str_replace( "\n", " ", htmlspecialchars( $this->tex ) ) . ' $</span>');
                }
                if( $this->tex == '' ) {
                        return; # bug 8372
@@ -288,7 +288,9 @@ class MathRenderer {
                } else {
                        return Xml::tags( 'span',
                                $this->_attribs( 'span',
-                                       array( 'class' => 'texhtml' ) ),
+                                       array( 'class' => 'texhtml',
+                                               'dir' => 'ltr'
+                                       ) ),
                                $this->html );
                }
        }