mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-11 15:36:28 +00:00
Fix: Don't render ' inside LR structures
$\left(a\right)'$ produced rendered MathML output that looked like $\left(a'\right)'$. * Remove the deriv (') state when rendering the element within the brackets. Bug: T381102 Change-Id: Id7f192c1f6b7bf4109e735e393e2546e5a39efd7
This commit is contained in:
parent
d50764230c
commit
0781935316
|
@ -74,7 +74,8 @@ class Lr extends TexNode {
|
|||
$moRight = new MMLmo( TexClass::CLOSE, $rightAttrs );
|
||||
$right = $moRight->encapsulateRaw( $this->right );
|
||||
}
|
||||
|
||||
// Don't apply outer ' inside the LR structure
|
||||
unset( $state['deriv'] );
|
||||
$inner = $this->getArg()->renderMML( [], $state );
|
||||
$mrow = new MMLmrow( TexClass::INNER );
|
||||
return $mrow->encapsulateRaw(
|
||||
|
|
|
@ -56,4 +56,17 @@ class LrTest extends MediaWikiUnitTestCase {
|
|||
'Should extract identifiers' );
|
||||
}
|
||||
|
||||
public function testRenderA() {
|
||||
$n = new Lr( '(', ')', new TexArray( new Literal( 'A' ) ) );
|
||||
$mml = $n->renderMML();
|
||||
$this->assertStringContainsString( 'A</mi>', $mml );
|
||||
$this->assertStringContainsString( ')</mo>', $mml );
|
||||
}
|
||||
|
||||
public function testRenderADeriv() {
|
||||
$n = new Lr( '(', ')', new TexArray( new Literal( 'A' ) ) );
|
||||
$mml = $n->renderMML( [], [ 'deriv' => 1 ] );
|
||||
$this->assertStringNotContainsString( '′</mo>', $mml );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -151,4 +151,9 @@ class TexArrayTest extends MediaWikiUnitTestCase {
|
|||
$this->assertEquals( $custom, $res[0] );
|
||||
}
|
||||
|
||||
public function testRenderADeriv() {
|
||||
$n = new TexArray( new Literal( 'A' ) );
|
||||
$mml = $n->renderMML( [], [ 'deriv' => 1 ] );
|
||||
$this->assertStringContainsString( '′</mo>', $mml );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue