mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-23 15:16:56 +00:00
Use the same formatting for align as MathJax
* Copy the default mtable attributes from MathJax * Adjust the test Bug: T348791 Bug: T375317 Change-Id: I274577e320056c1ac3a1f74cbc61941184afd61e
This commit is contained in:
parent
9321d6ffc7
commit
87f0315812
|
@ -122,10 +122,7 @@ class BaseParsing {
|
|||
$smth2 = null ) {
|
||||
// Parsing is very similar to AmsEQArray, maybe extract function ... tcs: 178
|
||||
$mrow = new MMLmrow();
|
||||
// tbd how are the table args composed ?
|
||||
$tableArgs = [ "columnalign" => "right",
|
||||
"columnspacing" => "0em", "displaystyle" => "true", "rowspacing" => "3pt" ];
|
||||
$mtable = new MMLmtable( "", $tableArgs );
|
||||
$mtable = new MMLmtable( "" );
|
||||
$mtr = new MMLmtr();
|
||||
$mtd = new MMLmtd();
|
||||
$renderedInner = "";
|
||||
|
@ -141,14 +138,8 @@ class BaseParsing {
|
|||
}
|
||||
|
||||
public static function amsEqnArray( $node, $passedArgs, $operatorContent, $name, $smth, $smth2 = null ) {
|
||||
// this goes for name =="aligned" ... tcs: 358 420 421
|
||||
$mrow = new MMLmrow();
|
||||
// tbd how are the table args composed ?
|
||||
|
||||
$direction = ( $name == "aligned" ) ? "left" : "right";
|
||||
$tableArgs = [ "columnalign" => $direction,
|
||||
"columnspacing" => "0em", "displaystyle" => "true", "rowspacing" => "3pt" ];
|
||||
$mtable = new MMLmtable( "", $tableArgs );
|
||||
$mtable = new MMLmtable( '' );
|
||||
$mtr = new MMLmtr();
|
||||
$mtd = new MMLmtd();
|
||||
$renderedInner = "";
|
||||
|
|
|
@ -12,7 +12,16 @@ use MediaWiki\Extension\Math\WikiTexVC\MMLmappings\TexConstants\TexClass;
|
|||
*/
|
||||
class MMLmtable extends MMLbase {
|
||||
|
||||
public function __construct( string $texclass = TexClass::ORD, array $attributes = [] ) {
|
||||
/** defaults to mtable args as generated from MathJax for align(ed) environment
|
||||
*/
|
||||
public function __construct(
|
||||
string $texclass = TexClass::ORD,
|
||||
array $attributes = [
|
||||
'columnalign' => 'right left right left right left right left right left right left',
|
||||
'columnspacing' => '0em 2em 0em 2em 0em 2em 0em 2em 0em 2em 0em',
|
||||
'displaystyle' => 'true',
|
||||
'rowspacing' => '3pt'
|
||||
] ) {
|
||||
parent::__construct( "mtable", $texclass, $attributes );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,9 @@ 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( "columnalign=\"right left right", $mathMLtexVC );
|
||||
$this->assertStringContainsString( "columnspacing=\"0em 2em 0em", $mathMLtexVC );
|
||||
$this->assertStringContainsString( "rowspacing=\"3pt\"", $mathMLtexVC );
|
||||
$this->assertStringContainsString( "mtable", $mathMLtexVC );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue