Fix table alignment to left

* currently, \begin{align} generates <mtable columnalign="right" but it should be <mtable columnalign="left"

Bug: T348791
Change-Id: Ic0df45aba4fdb6ffbdc790b5e4bc56e7daeca802
This commit is contained in:
Stegmujo 2023-10-13 10:43:42 +00:00
parent 1aae7cde53
commit 9360ca94c4
No known key found for this signature in database
GPG key ID: BB616B7CC84186BE
2 changed files with 10 additions and 1 deletions

View file

@ -164,7 +164,9 @@ class BaseParsing {
// this goes for name =="aligned" ... tcs: 358 420 421
$mrow = new MMLmrow();
// tbd how are the table args composed ?
$tableArgs = [ "columnalign" => "right",
$direction = ( $name == "aligned" ) ? "left" : "right";
$tableArgs = [ "columnalign" => $direction,
"columnspacing" => "", "displaystyle" => "true", "rowspacing" => "3pt" ];
$mtable = new MMLmtable( "", $tableArgs );
$mtr = new MMLmtr();

View file

@ -15,6 +15,13 @@ use MediaWikiUnitTestCase;
*/
class MMLRenderTest extends MediaWikiUnitTestCase {
public function testAlignLeft() {
$input = " \begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \\end{align} ";
$mathMLtexVC = $this->generateMML( $input );
$this->assertStringContainsString( "columnalign=\"left\"", $mathMLtexVC );
$this->assertStringContainsString( "mtable", $mathMLtexVC );
}
public function testLeftRightAttributes() {
$input = "\\left( \\right) \\left[ \\right]";
$mathMLtexVC = $this->generateMML( $input );