mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-24 07:34:22 +00:00
Fix bigcap and bigcup scripts not placed correctly
* All recognized macros are in category nullary macros, so this adds a rule * In test "\bigcap_{i=_1}^n E_i" * In test "\bigcup_{i=_1}^n E_i" Bug: T315978 Change-Id: I09287879c1448e404473891985457349a62554a7
This commit is contained in:
parent
4d3f6adc8f
commit
093ecf7c0f
|
@ -9,6 +9,7 @@ use MediaWiki\Extension\Math\TexVC\MMLnodes\MMLmrow;
|
||||||
use MediaWiki\Extension\Math\TexVC\MMLnodes\MMLmstyle;
|
use MediaWiki\Extension\Math\TexVC\MMLnodes\MMLmstyle;
|
||||||
use MediaWiki\Extension\Math\TexVC\MMLnodes\MMLmsubsup;
|
use MediaWiki\Extension\Math\TexVC\MMLnodes\MMLmsubsup;
|
||||||
use MediaWiki\Extension\Math\TexVC\MMLnodes\MMLmunderover;
|
use MediaWiki\Extension\Math\TexVC\MMLnodes\MMLmunderover;
|
||||||
|
use MediaWiki\Extension\Math\TexVC\TexUtil;
|
||||||
|
|
||||||
class FQ extends TexNode {
|
class FQ extends TexNode {
|
||||||
|
|
||||||
|
@ -73,7 +74,10 @@ class FQ extends TexNode {
|
||||||
// tbd check for more such cases like TexUtilTest 317
|
// tbd check for more such cases like TexUtilTest 317
|
||||||
$base = $this->getBase();
|
$base = $this->getBase();
|
||||||
if ( $base instanceof Literal ) {
|
if ( $base instanceof Literal ) {
|
||||||
if ( trim( $this->getBase()->getArgs()[0] ) === "\\sum" ) {
|
$litArg = trim( $this->getBase()->getArgs()[0] );
|
||||||
|
$tu = TexUtil::getInstance();
|
||||||
|
// "sum", "bigcap", "bigcup", "prod" ... all are nullary macros.
|
||||||
|
if ( $tu->nullary_macro( $litArg ) ) {
|
||||||
$melement = new MMLmunderover();
|
$melement = new MMLmunderover();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,17 @@ use MediaWikiUnitTestCase;
|
||||||
* @covers \MediaWiki\Extension\Math\TexVC\TexVC
|
* @covers \MediaWiki\Extension\Math\TexVC\TexVC
|
||||||
*/
|
*/
|
||||||
class MMLRenderTest extends MediaWikiUnitTestCase {
|
class MMLRenderTest extends MediaWikiUnitTestCase {
|
||||||
|
public function testBigcup() {
|
||||||
|
$input = "\bigcup_{i=_1}^n E_i";
|
||||||
|
$mathMLtexVC = $this->generateMML( $input );
|
||||||
|
$this->assertStringContainsString( "munderover", $mathMLtexVC );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testBigcap() {
|
||||||
|
$input = "\bigcap_{i=_1}^n E_i";
|
||||||
|
$mathMLtexVC = $this->generateMML( $input );
|
||||||
|
$this->assertStringContainsString( "munderover", $mathMLtexVC );
|
||||||
|
}
|
||||||
|
|
||||||
public function testNotOperatorname() {
|
public function testNotOperatorname() {
|
||||||
$input = "\\not\operatorname{R}";
|
$input = "\\not\operatorname{R}";
|
||||||
|
|
Loading…
Reference in a new issue