Skip to content

Commit 6c43c75

Browse files
Hyper-Nodephysikerwelt
authored andcommitted
Fix escape spacing
* In test "\text{if}~n\ \text{is even} " Bug: T315978 Change-Id: I839b7e912bc95abff1f589467c848fc8b2fb0fe6
1 parent b4290c1 commit 6c43c75

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/TexVC/MMLmappings/BaseMethods.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ public function parseOperatorDict( $node, $passedArgs, $operatorContent, $input,
127127
$mmlMo = new MMLmo();
128128
return $mmlMo->encapsulateRaw( ">" );
129129
case "\\":
130-
$mspace = new MMLmspace( "", [ "linebreak" => "newline" ] );
130+
// instead of carriage return, force whitespace here:
131+
// see: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Math/+/961213
132+
$mspace = new MMLmspace( "", [ "width" => "0.5em" ] );
131133
return $mspace->getEmpty();
132134
}
133135
return $input;

tests/phpunit/unit/TexVC/MMLRenderTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,17 @@ public function testStyle4() {
230230
$this->assertEquals( 2, $count );
231231
}
232232

233-
public function testCrLaTex() {
233+
public function testSpaceText() {
234+
$input = "\\text{if}~n\ \\text{is even} ";
235+
$mathMLtexVC = $this->generateMML( $input );
236+
$this->assertStringContainsString( "<mspace", $mathMLtexVC );
237+
}
238+
239+
public function testSpaceOther() {
240+
// It is expected to render CR as whitespace
234241
$input = "\,e_{x}=\sum _{t=1}^{\infty }\ _{t}p_{x}";
235242
$mathMLtexVC = $this->generateMML( $input );
236-
$this->assertStringContainsString( "<mspace linebreak=\"newline\"/>", $mathMLtexVC );
243+
$this->assertStringContainsString( "<mspace", $mathMLtexVC );
237244
}
238245

239246
public function testGenfracDQ() {

0 commit comments

Comments
 (0)