mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-24 07:34:22 +00:00
Render MathML for atop and choose
Bug: T340024 Change-Id: I19f471645b569db49a64e5dd4c82cfdbac7dbe77
This commit is contained in:
parent
7dfb557b92
commit
bbe6c3df8b
|
@ -663,12 +663,13 @@ class BaseParsing {
|
||||||
}
|
}
|
||||||
$inner = "";
|
$inner = "";
|
||||||
foreach ( $node->getArgs() as $arg ) {
|
foreach ( $node->getArgs() as $arg ) {
|
||||||
if ( $arg === "\\over" ) {
|
if ( is_string( $arg ) && str_contains( $arg, $name ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$rendered = $arg instanceof TexNode ? $arg->renderMML() : $arg;
|
$rendered = $arg instanceof TexNode ? $arg->renderMML() : $arg;
|
||||||
$inner .= $mrow->encapsulateRaw( $rendered );
|
$inner .= $mrow->encapsulateRaw( $rendered );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $start . $mfrac->encapsulateRaw( $inner ) . $tail;
|
return $start . $mfrac->encapsulateRaw( $inner ) . $tail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,27 @@ use MediaWikiUnitTestCase;
|
||||||
* @covers \MediaWiki\Extension\Math\TexVC\TexVC
|
* @covers \MediaWiki\Extension\Math\TexVC\TexVC
|
||||||
*/
|
*/
|
||||||
class MMLRenderTest extends MediaWikiUnitTestCase {
|
class MMLRenderTest extends MediaWikiUnitTestCase {
|
||||||
|
|
||||||
|
public function testAtop() {
|
||||||
|
$input = "{ a \atop b }";
|
||||||
|
$mathMLtexVC = $this->generateMML( $input );
|
||||||
|
$this->assertStringContainsString( "<mfrac linethickness=\"0\">", $mathMLtexVC );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testChoose() {
|
||||||
|
$input = "{ a \choose b }";
|
||||||
|
$mathMLtexVC = $this->generateMML( $input );
|
||||||
|
$this->assertStringContainsString( "<mfrac linethickness=\"0\">", $mathMLtexVC );
|
||||||
|
$this->assertStringContainsString( ")", $mathMLtexVC );
|
||||||
|
$this->assertStringContainsString( "(", $mathMLtexVC );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testOver() {
|
||||||
|
$input = "{a \over b }";
|
||||||
|
$mathMLtexVC = $this->generateMML( $input );
|
||||||
|
$this->assertStringContainsString( "<mfrac>", $mathMLtexVC );
|
||||||
|
}
|
||||||
|
|
||||||
public function testBigcup() {
|
public function testBigcup() {
|
||||||
$input = "\bigcup_{i=_1}^n E_i";
|
$input = "\bigcup_{i=_1}^n E_i";
|
||||||
$mathMLtexVC = $this->generateMML( $input );
|
$mathMLtexVC = $this->generateMML( $input );
|
||||||
|
|
Loading…
Reference in a new issue