Merge "Make native MathML rendering default"

This commit is contained in:
jenkins-bot 2024-09-17 10:46:54 +00:00 committed by Gerrit Code Review
commit 3652e8697e
3 changed files with 8 additions and 6 deletions

View file

@ -27,7 +27,7 @@
"MediaWiki\\Extension\\Math\\WikiTexVC\\MMLmappings\\Util\\MMLComparator": "tests/phpunit/unit/WikiTexVC/MMLComparator.php"
},
"DefaultUserOptions": {
"math": "mathml",
"math": "native",
"math-popups": "1"
},
"ExtensionMessagesFiles": {
@ -161,7 +161,8 @@
"description": "To access this at run-time, use MathConfig::getValidRenderingModes(). Do not use the non-normalized configuration directly.",
"value": [
"source",
"mathml"
"native",
"mathjax"
]
},
"MathEnableWikibaseDataType": {

View file

@ -162,7 +162,7 @@ class MathConfig {
* @param string $default rendering mode to use by default on unrecognized input
* @return string one of the self::MODE_* constants.
*/
public static function normalizeRenderingMode( $mode, string $default = self::MODE_MATHML ): string {
public static function normalizeRenderingMode( $mode, string $default = self::MODE_NATIVE_MML ): string {
if ( is_int( $mode ) ) {
$userOptionToMode = array_flip( self::MODES_TO_USER_OPTIONS );
return $userOptionToMode[$mode] ?? $default;

View file

@ -53,6 +53,8 @@ class MathConfigTest extends TestCase {
yield 'mathml user option' => [ 5, MathConfig::MODE_MATHML ];
yield 'latexml user option' => [ 7, MathConfig::MODE_LATEXML ];
yield 'native user option' => [ 8, MathConfig::MODE_NATIVE_MML ];
yield 'mathjax option' => [ 9, MathConfig::MODE_NATIVE_JAX ];
yield 'source string' => [ 'source', MathConfig::MODE_SOURCE ];
yield 'mathml string' => [ 'mathml', MathConfig::MODE_MATHML ];
yield 'latexml string' => [ 'latexml', MathConfig::MODE_LATEXML ];
@ -72,14 +74,13 @@ class MathConfigTest extends TestCase {
public function testGetValidRenderingModes() {
$mathConfig = $this->newMathConfig( [
'MathValidModes' => [
MathConfig::MODE_MATHML,
5,
MathConfig::MODE_NATIVE_MML,
MathConfig::MODE_SOURCE,
'this will be converted to mathml' ],
] );
$actualModes = $mathConfig->getValidRenderingModes();
$this->assertCount( 2, $actualModes );
$this->assertContains( MathConfig::MODE_MATHML, $actualModes );
$this->assertContains( MathConfig::MODE_NATIVE_MML, $actualModes );
$this->assertContains( MathConfig::MODE_SOURCE, $actualModes );
}