Overwrite spacing for divide

This overwrite should be removed once this is the
default in all browsers.

Bug: T375337
Change-Id: I5ab133f0368ed6eef94b0a87281bb9129fca406c
(cherry picked from commit 758f9c987a)
This commit is contained in:
physikerwelt 2024-11-10 16:45:23 +01:00 committed by Krinkle
parent 473064eaa7
commit 0658c42bf5
3 changed files with 13 additions and 1 deletions

View file

@ -131,6 +131,9 @@ class BaseMethods {
// see: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Math/+/961213 // see: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Math/+/961213
$mspace = new MMLmspace( "", [ "width" => "0.5em" ] ); $mspace = new MMLmspace( "", [ "width" => "0.5em" ] );
return $mspace->getEmpty(); return $mspace->getEmpty();
case '/':
$mmlMo = new MMLmo( '', [ 'lspace' => '0', 'rspace' => '0' ] );
return $mmlMo->encapsulateRaw( $input );
} }
return $input; return $input;
} }

View file

@ -35,7 +35,7 @@ class OperatorDictionary {
'->' => [ " exports.MO.BIN5" ], '->' => [ " exports.MO.BIN5" ],
'.' => [ " [0, 3], MmlNode_js_1.TEXCLASS.PUNCT\"], { separator=> [ true }]" ], '.' => [ " [0, 3], MmlNode_js_1.TEXCLASS.PUNCT\"], { separator=> [ true }]" ],
':' => [ " [1, 2], MmlNode_js_1.TEXCLASS.REL\"], null]" ], ':' => [ " [1, 2], MmlNode_js_1.TEXCLASS.REL\"], null]" ],
'/' => [ " exports.MO.ORD11" ], '/' => [ " exports.MO.ORD11", true ],
'//' => [ " OPDEF(1\"], 1)" ], '//' => [ " OPDEF(1\"], 1)" ],
'/=' => [ " exports.MO.BIN4" ], '/=' => [ " exports.MO.BIN4" ],
'=>' => [ " [1, 2], MmlNode_js_1.TEXCLASS.REL\"], null]" ], '=>' => [ " [1, 2], MmlNode_js_1.TEXCLASS.REL\"], null]" ],

View file

@ -124,4 +124,13 @@ class LiteralTest extends MediaWikiUnitTestCase {
'exclamation mark should render as special operator.' ); 'exclamation mark should render as special operator.' );
} }
public function testDivide() {
$n = new Literal( '/' );
$real = $n->renderMML();
$this->assertStringContainsString( '/</mo>', $real,
'divide should render as special operator.' );
$this->assertStringContainsString( 'lspace="0" rspace="0"', $real,
'divide should have no spacing.' );
}
} }