r104498 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104497‎ | r104498 | r104499 >
Date:22:30, 28 November 2011
Author:brion
Status:ok (Comments)
Tags:
Comment:
Disable the partial HTML and MathML rendering options for Math extension.

MathML mode was so incomplete most people thought it simply didn't work (bug 25646).
HTML modes often rendered poorly (eg req bug 24207 to set default to PNG on some sites)

This may cause regressions in that simple "equations" of just variables that came out as HTML
will now render as PNGs that don't get aligned properly with the text baseline. Fixing this is
covered by bug 32694: <https://bugzilla.wikimedia.org/show_bug.cgi?id=32694&gt; to retrieve the
baseline info from dvipng and position images to fit.

Note that because of the way user options are pulled in to the oarser cache key, some folks
may see cached pages with their old settings until they get redone or they save their prefs
again and have it normalized.
Modified paths:
  • /trunk/extensions/Math/Math.body.php (modified) (history)
  • /trunk/extensions/Math/Math.hooks.php (modified) (history)
  • /trunk/extensions/Math/Math.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Math/Math.body.php
@@ -30,7 +30,7 @@
3131 * @ingroup Parser
3232 */
3333 class MathRenderer {
34 - var $mode = MW_MATH_MODERN;
 34+ var $mode = MW_MATH_PNG;
3535 var $tex = '';
3636 var $inputhash = '';
3737 var $hash = '';
@@ -44,7 +44,13 @@
4545 }
4646
4747 function setOutputMode( $mode ) {
48 - $this->mode = $mode;
 48+ $validModes = array( MW_MATH_PNG, MW_MATH_SOURCE );
 49+ if ( in_array( $mode, $validModes ) ) {
 50+ $this->mode = $mode;
 51+ } else {
 52+ // Several mixed modes have been phased out.
 53+ $this->mode = MW_MATH_PNG;
 54+ }
4955 }
5056
5157 function render() {
Index: trunk/extensions/Math/Math.php
@@ -31,11 +31,11 @@
3232 * Maths constants
3333 */
3434 define( 'MW_MATH_PNG', 0 );
35 -define( 'MW_MATH_SIMPLE', 1 );
36 -define( 'MW_MATH_HTML', 2 );
 35+define( 'MW_MATH_SIMPLE', 1 ); /// @deprecated
 36+define( 'MW_MATH_HTML', 2 ); /// @deprecated
3737 define( 'MW_MATH_SOURCE', 3 );
38 -define( 'MW_MATH_MODERN', 4 );
39 -define( 'MW_MATH_MATHML', 5 );
 38+define( 'MW_MATH_MODERN', 4 ); /// @deprecated
 39+define( 'MW_MATH_MATHML', 5 ); /// @deprecated
4040 /**@}*/
4141
4242 /** For back-compat */
@@ -84,6 +84,7 @@
8585
8686 ////////// end of config settings.
8787
 88+$wgDefaultUserOptions['math'] = MW_MATH_PNG;
8889
8990 $wgExtensionFunctions[] = 'MathHooks::setup';
9091 $wgHooks['ParserFirstCallInit'][] = 'MathHooks::onParserFirstCallInit';
Index: trunk/extensions/Math/Math.hooks.php
@@ -74,11 +74,7 @@
7575 private static function getMathNames() {
7676 return array(
7777 MW_MATH_PNG => 'mw_math_png',
78 - MW_MATH_SIMPLE => 'mw_math_simple',
79 - MW_MATH_HTML => 'mw_math_html',
80 - MW_MATH_SOURCE => 'mw_math_source',
81 - MW_MATH_MODERN => 'mw_math_modern',
82 - MW_MATH_MATHML => 'mw_math_mathml'
 78+ MW_MATH_SOURCE => 'mw_math_source'
8379 );
8480 }
8581

Follow-up revisions

RevisionCommit summaryAuthorDate
r104575Followup r104498: remove now-unused messages for dropped math rendering modesbrion16:53, 29 November 2011

Comments

#Comment by Raymond (talk | contribs)   08:32, 29 November 2011

Are the messages

	'mw_math_simple' => 'HTML if very simple or else PNG',
	'mw_math_html' => 'HTML if possible or else PNG',
	'mw_math_modern' => 'Recommended for modern browsers',
	'mw_math_mathml' => 'MathML if possible (experimental)',

still needed or can they be removed from Math.i18n.php?

#Comment by Brion VIBBER (talk | contribs)   16:30, 29 November 2011

Indeed, they can go.

#Comment by Brion VIBBER (talk | contribs)   16:54, 29 November 2011

Done in r104575.

#Comment by He7d3r (talk | contribs)   18:02, 5 February 2012

Is this going live with MediaWiki 1.19? I didn't find anything about it on that page and neither on RELEASE-NOTES-1.19

#Comment by Reedy (talk | contribs)   18:03, 5 February 2012

It's not in core, so it's not going to be in RELEASE-NOTES-1.19

#Comment by He7d3r (talk | contribs)   18:08, 5 February 2012

But will it affect Wikipedia once the software is updated there? If so, I think it would be good idea to mention it on MediaWiki 1.19.

#Comment by He7d3r (talk | contribs)   18:55, 5 February 2012

The list of options on enwiki differs from what is available on Wikimedia labs. So I believe when MW 1.19 is deployed, together with the newer version of the extensions, there will be a visible change on Wikimedia wikis, because the default math rendering is not PNG.

BTW: Would this change cause any cache problems on big wikis, considering that a lot (?) of formulas would need to be re-rendered in PNG?

Status & tagging log