Ignore misplaced limits commands

Instead of rendering \limits or \nolimits when those
commands are misplaced the commands are ignored.

TeX does it the same way, but issues a warning in addition.
Issuing the warning will be taken care of in a follow-up commit.

Bug: T365170
Change-Id: Ic1c28be2a5669183c3dd5d15577a35a1b5a76971
This commit is contained in:
physikerwelt 2024-11-05 15:46:42 +01:00 committed by Physikerwelt
parent 18df3d31a1
commit b058d88bf9
2 changed files with 5 additions and 3 deletions

View file

@ -930,7 +930,7 @@ class BaseParsing {
}
}
$mrow = new MMLmrow( TexClass::ORD, [] );
$opParsed = ( $operatorContent != null && $operatorContent["limits"] )
$opParsed = ( $operatorContent["limits"] ?? false )
? $operatorContent["limits"]->renderMML( $argsOp ) : "";
if ( $node instanceof DQ ) {
@ -940,6 +940,9 @@ class BaseParsing {
$munderOver = new MMLmunderover();
return $munderOver->encapsulateRaw( $opParsed . $mrow->encapsulateRaw( $node->getDown()->renderMML() )
. $mrow->encapsulateRaw( $node->getUp()->renderMML() ) );
} elseif ( $name === 'limits' || $name === 'nolimits' ) {
// Don't render limits
return '';
}
}

View file

@ -118,8 +118,7 @@ class Literal extends TexNode {
$ret = BaseMethods::checkAndParse( $inputP, $arguments,
array_merge( $operatorContent ?? [], $state ?? [] ),
$this, false );
if ( $ret ) {
if ( $ret || $ret === '' ) {
return $ret;
}