diff --git a/src/TexVC/MMLmappings/BaseParsing.php b/src/TexVC/MMLmappings/BaseParsing.php index 8386bbd43..b72fe31ff 100644 --- a/src/TexVC/MMLmappings/BaseParsing.php +++ b/src/TexVC/MMLmappings/BaseParsing.php @@ -486,12 +486,11 @@ class BaseParsing { case "bmod": $mo = new MMLmo( "", [ "lspace" => Sizes::THICKMATHSPACE, "rspace" => Sizes::THICKMATHSPACE ] ); $mmlRow = new MMLmrow( TexClass::ORD ); - $mstyle = new MMLmstyle( "", [ "scriptlevel" => "0" ] ); $mspace = new MMLmspace( "", [ "width" => "0.167em" ] ); $inner = $node->getArg() instanceof TexNode ? $mmlRow->encapsulateRaw( $node->getArg()->renderMML() ) : ""; return $mmlRow->encapsulateRaw( $mo->encapsulate( "mod" ) . - $inner . $mmlRow->encapsulateRaw( $mstyle->encapsulateRaw( $mspace->getEmpty() ) ) ); + $inner . $mmlRow->encapsulateRaw( $mspace->getEmpty() ) ); case "implies": $mstyle = new MMLmstyle( "", [ "scriptlevel" => "0" ] ); $mspace = new MMLmspace( "", [ "width" => "0.278em" ] ); @@ -1018,11 +1017,9 @@ class BaseParsing { } public static function spacer( $node, $passedArgs, $operatorContent, $name, $withIn = null, $smth2 = null ) { - // var node = parser.create('node', 'mspace', [], { width: (0, lengths_js_1.em)(space) }); - $mstyle = new MMLmstyle( "", [ "scriptlevel" => "0" ] ); $width = MMLutil::round2em( $withIn ); $mspace = new MMLmspace( "", [ "width" => $width ] ); - return $mstyle->encapsulateRaw( $mspace->encapsulate() ); + return $mspace->encapsulate(); } public static function smash( $node, $passedArgs, $operatorContent, $name ) { diff --git a/tests/phpunit/unit/TexVC/MMLRenderTest.php b/tests/phpunit/unit/TexVC/MMLRenderTest.php index ad5fcfe11..95eeff15b 100644 --- a/tests/phpunit/unit/TexVC/MMLRenderTest.php +++ b/tests/phpunit/unit/TexVC/MMLRenderTest.php @@ -14,6 +14,12 @@ use MediaWikiUnitTestCase; * @covers \MediaWiki\Extension\Math\TexVC\TexVC */ class MMLRenderTest extends MediaWikiUnitTestCase { + public function testSpacesNoMstyle() { + $input = "\bmod \, \!"; + $mathMLtexVC = $this->generateMML( $input ); + $this->assertStringContainsString( "mspace", $mathMLtexVC ); + $this->assertStringNotContainsString( "mstyle", $mathMLtexVC ); + } public function testAlignLeft() { $input = " \begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \\end{align} "; @@ -182,7 +188,6 @@ class MMLRenderTest extends MediaWikiUnitTestCase { public function testRenderSpaceSemicolon() { $input = "{\\;}"; $mathMLtexVC = $this->generateMML( $input ); - $this->assertStringContainsString( "mstyle", $mathMLtexVC ); $this->assertStringContainsString( "mspace", $mathMLtexVC, ); }