Overwrite spacing for divide

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

Bug: T375337
Change-Id: I5ab133f0368ed6eef94b0a87281bb9129fca406c
This commit is contained in:
physikerwelt 2024-11-10 16:45:23 +01:00
parent 5cde747b49
commit 758f9c987a
No known key found for this signature in database
GPG key ID: FCC793EFFA5FB13C
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
$mspace = new MMLmspace( "", [ "width" => "0.5em" ] );
return $mspace->getEmpty();
case '/':
$mmlMo = new MMLmo( '', [ 'lspace' => '0', 'rspace' => '0' ] );
return $mmlMo->encapsulateRaw( $input );
}
return $input;
}

View file

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