diff --git a/src/WikiTexVC/Nodes/Lr.php b/src/WikiTexVC/Nodes/Lr.php index 228066457..89249d63d 100644 --- a/src/WikiTexVC/Nodes/Lr.php +++ b/src/WikiTexVC/Nodes/Lr.php @@ -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( diff --git a/tests/phpunit/unit/WikiTexVC/Nodes/LrTest.php b/tests/phpunit/unit/WikiTexVC/Nodes/LrTest.php index c36e0e165..d621373e1 100644 --- a/tests/phpunit/unit/WikiTexVC/Nodes/LrTest.php +++ b/tests/phpunit/unit/WikiTexVC/Nodes/LrTest.php @@ -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', $mml ); + $this->assertStringContainsString( ')', $mml ); + } + + public function testRenderADeriv() { + $n = new Lr( '(', ')', new TexArray( new Literal( 'A' ) ) ); + $mml = $n->renderMML( [], [ 'deriv' => 1 ] ); + $this->assertStringNotContainsString( '′', $mml ); + } + } diff --git a/tests/phpunit/unit/WikiTexVC/Nodes/TexArrayTest.php b/tests/phpunit/unit/WikiTexVC/Nodes/TexArrayTest.php index ab1e3cba4..76d1453db 100644 --- a/tests/phpunit/unit/WikiTexVC/Nodes/TexArrayTest.php +++ b/tests/phpunit/unit/WikiTexVC/Nodes/TexArrayTest.php @@ -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( '′', $mml ); + } }