r85464 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85463‎ | r85464 | r85465 >
Date:19:51, 5 April 2011
Author:bawolff
Status:resolved (Comments)
Tags:
Comment:
(bug 28430) Make HTML and TeX output of <math> tags be LTR always

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}^ $
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Math.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Math.php
@@ -38,7 +38,7 @@
3939 if( $this->mode == MW_MATH_SOURCE ) {
4040 # No need to render or parse anything more!
4141 # New lines are replaced with spaces, which avoids confusing our parser (bugs 23190, 22818)
42 - return ('<span class="tex">$ ' . str_replace( "\n", " ", htmlspecialchars( $this->tex ) ) . ' $</span>');
 42+ return ('<span class="tex" dir="ltr">$ ' . str_replace( "\n", " ", htmlspecialchars( $this->tex ) ) . ' $</span>');
4343 }
4444 if( $this->tex == '' ) {
4545 return; # bug 8372
@@ -288,7 +288,9 @@
289289 } else {
290290 return Xml::tags( 'span',
291291 $this->_attribs( 'span',
292 - array( 'class' => 'texhtml' ) ),
 292+ array( 'class' => 'texhtml',
 293+ 'dir' => 'ltr'
 294+ ) ),
293295 $this->html );
294296 }
295297 }
Index: trunk/phase3/RELEASE-NOTES
@@ -225,6 +225,7 @@
226226 * (bug 28417) Fix PHP notice when importing revision without a listed id
227227 * (bug 28394) Set forgotten parameters types in ApiUnblock
228228 * (bug 28395) Set forgotten parameters types in ApiParse
 229+* (bug 28430) Make html and TeX output of <math> always be left-to-right.
229230
230231 === API changes in 1.18 ===
231232 * (bug 26339) Throw warning when truncating an overlarge API result

Follow-up revisions

RevisionCommit summaryAuthorDate
r85672Followup to r85464, correct parser testoverlordq16:17, 8 April 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   21:49, 8 April 2011

This unfortunately doesn't seem to take effect on fractions which are rendered as a table, probably because the Sanitizer is breaking the <table> out of the surrounding <span>. But there may not be much to do about that, other than junking the awful rendering mode. :P Could maybe detect it and change it to a div since the span would break anyway...

#Comment by Bawolff (talk | contribs)   21:54, 8 April 2011

(adding closing span, so CR doesn't throw a hissy). I didn't even realize that it could make tables. I'll look into that further.

#Comment by Reedy (talk | contribs)   21:58, 8 April 2011

Fixed in the database!

#Comment by Brion VIBBER (talk | contribs)   23:28, 21 June 2011

Marking resolved for r85672 test case fixup. The table issue is still there but that's already equally broken so meh. :D

Status & tagging log