mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-11 16:58:38 +00:00
Fix calls to trim null
Bug: T348936 Change-Id: I6e3fca041fb81975b175977b9a18d69fbf58620b
This commit is contained in:
parent
f031bd07c5
commit
ac1d7a9a7b
|
@ -197,7 +197,11 @@ class BaseMethods {
|
|||
|
||||
public function checkAndParseDelimiter( $input, $node, $passedArgs,
|
||||
$operatorContent, $noargs = false, $texClass = "" ) {
|
||||
if ( $input === null ) {
|
||||
return null;
|
||||
}
|
||||
$resDelimiter = BaseMappings::getDelimiterByKey( trim( $input ) );
|
||||
|
||||
if ( $resDelimiter == null ) {
|
||||
$input = MMLutil::inputPreparation( $input );
|
||||
$resDelimiter = AMSMappings::getSymbolDelimiterByKey( $input );
|
||||
|
|
|
@ -157,6 +157,9 @@ class MMLutil {
|
|||
* @return string prepared input string
|
||||
*/
|
||||
public static function inputPreparation( $input ): string {
|
||||
if ( $input === null ) {
|
||||
return "";
|
||||
}
|
||||
$input = trim( $input );
|
||||
if ( str_starts_with( $input, "\\" ) && strlen( $input ) >= 2 ) {
|
||||
$input = substr( $input, 1 );
|
||||
|
|
|
@ -15,6 +15,11 @@ use MediaWikiUnitTestCase;
|
|||
* @covers \MediaWiki\Extension\Math\TexVC\TexVC
|
||||
*/
|
||||
class MMLRenderTest extends MediaWikiUnitTestCase {
|
||||
public function testTrimNull() {
|
||||
$input = "\\bigl( \\begin{smallmatrix}a&b\\\\ c&d\\end{smallmatrix} \\bigr)";
|
||||
$mathMLtexVC = $this->generateMML( $input );
|
||||
$this->assertStringContainsString( "mtable", $mathMLtexVC );
|
||||
}
|
||||
|
||||
public function testApplyOperator1() {
|
||||
$input = "\sup x";
|
||||
|
|
Loading…
Reference in a new issue