Page MenuHomePhabricator

Duplicate MathJax preference
Closed, ResolvedPublic

Description

I've been installing a local copy of MediaWiki with the Math extension and MathJax enabled. Looking at the preferences Special:Preferences#mw-prefsection-rendering the MathJax option appears twice: once as radio button and once as a check box.

I've a clean install using
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Math.git
and a git clone of the latest mediawiki.

my LocalSettings.php is pretty much copied direct from https://www.mediawiki.org/wiki/Extension:Math

require_once( "$IP/extensions/Math/Math.php" );
Set this if you don't use MediaWiki Math's texvc:
$wgTexvc = '/your/path/to/texvc';

Be sure to have a math directory with writing
permission and that these two variables are set or
// default to that directory:
$wgMathDirectory = $wgScriptPath . '/mathCache';
$wgMathPath = 'http://localhost/~rich/mediawiki/mathCache';

$wgMathValidModes[] = MW_MATH_MATHJAX; adding MathJax as rendering option
or
$wgMathValidModes = array( MW_MATH_MATHJAX ); setting MathJax as only rendering option (optional)

$wgUseMathJax = true; enabeling MathJax as rendering option
$wgDefaultUserOptions['mathJax'] = true;
setting MathJax as default rendering option (optional)

I think this may relate to
https://gerrit.wikimedia.org/r/#/c/127607/

Also if I change the rendering options to
$wgMathValidModes[] = MW_MATH_MATHJAX; adding MathJax as rendering option
or
$wgMathValidModes = array( MW_MATH_MATHJAX );
setting MathJax as only rendering option (optional)

I get [b768f98f] 2014-05-04 19:11:43: Fatal exception of type MWException when trying to view my preferences


Version: REL1_23-branch
Severity: normal

Details

Reference
bz64844

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:14 AM
bzimport added a project: Math.
bzimport set Reference to bz64844.

physik wrote:

You don't need to add MW_MATH_MATHJAX to the $wgMathValidModes[] array.
The documentation might be outdated.
The Math extension in the master branch is currently between versions 1.1 and 2.0.
It would be great to get code review for the last changes to get version 2.0 live. After that documentation needs to be updated and new developments can base on the master branch with version 2.0.

Yes I see. Just getting my head round git and versions. Hopefully I get to look at the math2_0_0 branch. I've just checked it out and rerun the update script. Special:Version is still reporting the version as 1.1. I think this is something in Math.php. (Actually an earlier version than master which is 1.2.)

I guess this bug can be closed or maybe repurpose as a documentation bug.

Ah I think I got the wrong branch. Is it the origin/dev for the 2.0 version? Its not at all clear from https://www.mediawiki.org/wiki/Extension:Math how to get the 2.0 version.

With origin/dev both

$wgMathValidModes[] = MW_MATH_MATHJAX; // adding MathJax as rendering option

and

$wgMathValidModes = array( MW_MATH_MATHJAX ); // setting MathJax as only

give Fatal exception and I have to comment them both out.

physik wrote:

I think the documentation was wrong. I fixed it on
https://www.mediawiki.org/wiki/Extension:Math

The second option should work with master and dev.
Sorry for the inconvenience.

physik wrote:

i.e. the setting should be
$wgMathValidModes = array( MW_MATH_MATHSOURCE ); // setting Source as only serverside output

I get an exception for

$wgMathValidModes = array( MW_MATH_MATHSOURCE );

I think it should be

$wgMathValidModes = array( MW_MATH_SOURCE );

as that matches Math.hooks.php getMathNames(). That cures one error using a defined name but creates another error with

[35c6258e] /~rich/mediawiki/index.php/Special:Preferences Exception from line 134 of /Users/rich/Sites/mediawiki/includes/Preferences.php: Global default '5' is invalid for field math

I think 5 is the numeric value of MW_MATH_MATHML and Math.php has a default

$wgDefaultUserOptions['math'] = MW_MATH_MATHML;

so its can't find the default in the array. I've now got

$wgMathValidModes[] = MW_MATH_SOURCE;

which works, but I don't think its needed at all as its already defined in Math.php

$wgMathValidModes = array( MW_MATH_PNG, MW_MATH_SOURCE, MW_MATH_MATHML );

physik wrote:

Yes you are right.
I have insufficents rights to change Math extension page
https://www.mediawiki.org/w/index.php?title=Extension:Math&oldid=944056&diff=cur

I'll commit a patch that checks for invalid default values.

Change 131439 had a related patch set uploaded by Physikerwelt:
Catch misconfiguration of math default option

https://gerrit.wikimedia.org/r/131439

Change 131439 merged by jenkins-bot:
Catch misconfiguration of math default option

https://gerrit.wikimedia.org/r/131439