mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-27 17:01:07 +00:00
Remove mstyle around spacing elements
* From Feedback: There is a curious use of <mstyle> around spacing elements, as in <mstyle scriptlevel="0"><mspace width="-0.167em"></mspace></mstyle>. I am not sure that wrapper element is needed? The mspace ought to be successful standalone. * this is in the 'bmod' case Bug: T349822 Change-Id: I9229ad73891d5000679761d3d4b2028d4a51ddf1
This commit is contained in:
parent
06038f8bae
commit
8112c65a5d
|
@ -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 ) {
|
||||
|
|
|
@ -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, );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue