Merge "Add \| to list of special operators"

This commit is contained in:
jenkins-bot 2024-10-07 12:09:14 +00:00 committed by Gerrit Code Review
commit 65f3e1bc95
2 changed files with 7 additions and 1 deletions

View file

@ -166,7 +166,7 @@ class MMLutil {
if ( str_starts_with( $input, "\\" ) && strlen( $input ) >= 2 ) {
$input = substr( $input, 1 );
// These are edge cases where input can be a Literal OR an Operator
$edgeCases = [ "S", "P", ";", ",", "!", "'", ">" ];
$edgeCases = [ "S", "P", ";", ",", "!", "'", ">", "|" ];
if ( in_array( $input, $edgeCases, true ) ) {
$input = "\\" . $input;
}

View file

@ -94,4 +94,10 @@ class LiteralTest extends MediaWikiUnitTestCase {
'hboxes should not be wrapped in to mi elements.' );
}
public function testDoubleVerticalLine() {
$n = new Literal( '\\|' );
$this->assertStringContainsString( '&#x2016;</mo>', $n->renderMML(),
'double vertical line should render as special operator.' );
}
}