From 09679f2f39e6c6c00e87757292421b26bfa7022a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 28 Nov 2011 22:30:33 +0000 Subject: [PATCH] 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: 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. --- Math.body.php | 10 ++++++++-- Math.hooks.php | 6 +----- Math.php | 9 +++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Math.body.php b/Math.body.php index 54550bb..f4d2481 100644 --- a/Math.body.php +++ b/Math.body.php @@ -30,7 +30,7 @@ if ( !function_exists('wfEscapeSingleQuotes') ) { * @ingroup Parser */ class MathRenderer { - var $mode = MW_MATH_MODERN; + var $mode = MW_MATH_PNG; var $tex = ''; var $inputhash = ''; var $hash = ''; @@ -44,7 +44,13 @@ class MathRenderer { } function setOutputMode( $mode ) { - $this->mode = $mode; + $validModes = array( MW_MATH_PNG, MW_MATH_SOURCE ); + if ( in_array( $mode, $validModes ) ) { + $this->mode = $mode; + } else { + // Several mixed modes have been phased out. + $this->mode = MW_MATH_PNG; + } } function render() { diff --git a/Math.hooks.php b/Math.hooks.php index 4875838..25a7b39 100644 --- a/Math.hooks.php +++ b/Math.hooks.php @@ -74,11 +74,7 @@ class MathHooks { private static function getMathNames() { return array( MW_MATH_PNG => 'mw_math_png', - MW_MATH_SIMPLE => 'mw_math_simple', - MW_MATH_HTML => 'mw_math_html', - MW_MATH_SOURCE => 'mw_math_source', - MW_MATH_MODERN => 'mw_math_modern', - MW_MATH_MATHML => 'mw_math_mathml' + MW_MATH_SOURCE => 'mw_math_source' ); } diff --git a/Math.php b/Math.php index a2477b7..bfc4e68 100644 --- a/Math.php +++ b/Math.php @@ -31,11 +31,11 @@ $wgExtensionCredits['parserhook'][] = array( * Maths constants */ define( 'MW_MATH_PNG', 0 ); -define( 'MW_MATH_SIMPLE', 1 ); -define( 'MW_MATH_HTML', 2 ); +define( 'MW_MATH_SIMPLE', 1 ); /// @deprecated +define( 'MW_MATH_HTML', 2 ); /// @deprecated define( 'MW_MATH_SOURCE', 3 ); -define( 'MW_MATH_MODERN', 4 ); -define( 'MW_MATH_MATHML', 5 ); +define( 'MW_MATH_MODERN', 4 ); /// @deprecated +define( 'MW_MATH_MATHML', 5 ); /// @deprecated /**@}*/ /** For back-compat */ @@ -84,6 +84,7 @@ $wgMathDirectory = false; ////////// end of config settings. +$wgDefaultUserOptions['math'] = MW_MATH_PNG; $wgExtensionFunctions[] = 'MathHooks::setup'; $wgHooks['ParserFirstCallInit'][] = 'MathHooks::onParserFirstCallInit';