Add \| to list of special operators

Bug: T376546
Change-Id: Ibf57c995c2381fea095600c31ce6432a1e8fd4fd
This commit is contained in:
physikerwelt 2024-10-05 23:00:34 +02:00
parent cebab4fc89
commit ca10252923
No known key found for this signature in database
GPG key ID: FCC793EFFA5FB13C
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.' );
}
}