Remove too many rows in smallmatrix

* From Feedback: The {smallmatrix} example has its fences wrapped in too many mrows I think, so it renders without stretching them in both Firefox and Chrome. Ideally you should be able to emit the <mo>(</mo> followed directly by an <mtable>, and trailed by <mo>)</mo>, and only wrap those 3 into a parent <mrow>.
* removes mrows and adds OPEN / CLOSE attributes
* tests MMLFullcoverage 194 to ~196 which cover the bigXYZ macros look
  ok

Bug: T348971
Change-Id: Ie444e5bb3e3f87fac915d2692b69e976d721582e
This commit is contained in:
Stegmujo 2023-10-11 09:21:53 +00:00
parent 06038f8bae
commit a53a5d58c8
No known key found for this signature in database
GPG key ID: BB616B7CC84186BE
2 changed files with 17 additions and 3 deletions

View file

@ -892,10 +892,8 @@ class BaseParsing {
$sizeShortened = MMLutil::size2em( strval( $size ) );
$mrowOuter = new MMLmrow( TexClass::ORD, [] );
$mrow = new MMLmrow( $texClass, [] );
$passedArgs = array_merge( $passedArgs, [ "maxsize" => $sizeShortened, "minsize" => $sizeShortened ] );
$mo = new MMLmo( "", $passedArgs );
// Sieve arg if it is a delimiter (it seems args are not applied here
$bm = new BaseMethods();
$argcurrent = trim( $node->getArg() );
@ -917,9 +915,18 @@ class BaseParsing {
$passedArgs, [ "stretchy" => "true", "symmetric" => "true" ] );
break;
}
if ( in_array( $name, [ "bigl","Bigl", "biggl", "Biggl" ] ) ) {
$passedArgs = [ Tag::CLASSTAG => TexClass::OPEN ];
}
if ( in_array( $name, [ "bigr","Bigr","biggr","Biggr" ] ) ) {
$passedArgs = [ Tag::CLASSTAG => TexClass::CLOSE ];
}
$ret = $bm->checkAndParseDelimiter( $node->getArg(), $node, $passedArgs, $operatorContent, true );
if ( $ret ) {
return $mrowOuter->encapsulateRaw( $mrow->encapsulateRaw( $ret ) );
return $ret;
}
$argPrep = MMLutil::inputPreparation( $node->getArg() );

View file

@ -3,6 +3,7 @@
namespace MediaWiki\Extension\Math\Tests\TexVC;
use MediaWiki\Extension\Math\TexVC\MMLmappings\TexConstants\Tag;
use MediaWiki\Extension\Math\TexVC\MMLmappings\TexConstants\TexClass;
use MediaWiki\Extension\Math\TexVC\MMLmappings\Util\MMLTestUtil;
use MediaWiki\Extension\Math\TexVC\TexVC;
use MediaWikiUnitTestCase;
@ -15,6 +16,12 @@ use MediaWikiUnitTestCase;
*/
class MMLRenderTest extends MediaWikiUnitTestCase {
public function testBigl() {
$input = "\bigl(";
$mathMLtexVC = $this->generateMML( $input );
$this->assertStringContainsString( TexClass::OPEN, $mathMLtexVC );
}
public function testAlignLeft() {
$input = " \begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \\end{align} ";
$mathMLtexVC = $this->generateMML( $input );