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> 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.
This commit is contained in:
Brion Vibber 2011-11-28 22:30:33 +00:00
parent ecf798b9de
commit 09679f2f39
3 changed files with 14 additions and 11 deletions

View File

@ -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() {

View File

@ -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'
);
}

View File

@ -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';