File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 6
6
7
7
use MediaWiki \Extension \Math \TexVC \MMLmappings \BaseParsing ;
8
8
use MediaWiki \Extension \Math \TexVC \MMLnodes \MMLmrow ;
9
+ use MediaWiki \Extension \Math \TexVC \MMLnodes \MMLmstyle ;
9
10
use MediaWiki \Extension \Math \TexVC \MMLnodes \MMLmsubsup ;
10
11
use MediaWiki \Extension \Math \TexVC \MMLnodes \MMLmunderover ;
11
12
@@ -84,10 +85,18 @@ public function renderMML( $arguments = [], $state = [] ) {
84
85
$ emptyMrow = $ mrow ->getEmpty ();
85
86
}
86
87
// This seems to be the common case
87
- return $ melement ->encapsulateRaw (
88
+ $ inner = $ melement ->encapsulateRaw (
88
89
$ emptyMrow .
89
90
$ this ->getBase ()->renderMML ( [], $ state ) .
90
91
$ mrow ->encapsulateRaw ( $ this ->getDown ()->renderMML ( [], $ state ) ) .
91
92
$ mrow ->encapsulateRaw ( $ this ->getUp ()->renderMML ( [], $ state ) ) );
93
+
94
+ if ( $ melement instanceof MMLmunderover ) {
95
+ $ args = $ state ['styleargs ' ] ?? [ "displaystyle " => "true " , "scriptlevel " => 0 ];
96
+ $ style = new MMLmstyle ( "" , $ args );
97
+ return $ style ->encapsulateRaw ( $ inner );
98
+ }
99
+
100
+ return $ inner ;
92
101
}
93
102
}
Original file line number Diff line number Diff line change 14
14
* @covers \MediaWiki\Extension\Math\TexVC\TexVC
15
15
*/
16
16
class MMLRenderTest extends MediaWikiUnitTestCase {
17
- public function testUnderbrace () {
18
- $ input = "\u nderbrace{ a+b+\cdots+z }_{26} " ;
17
+
18
+ public function testUnder () {
19
+ $ input = "\\underbrace{ a+b+ \\cdots+z }_{26} " ;
19
20
$ mathMLtexVC = $ this ->generateMML ( $ input );
20
21
$ this ->assertStringContainsString ( "<munder> " , $ mathMLtexVC );
21
22
$ this ->assertStringNotContainsString ( "<msub> " , $ mathMLtexVC );
22
23
}
23
24
25
+ public function testSumDisplaystyle () {
26
+ $ input = "\sum_{k=1}^N k^2 " ;
27
+ $ mathMLtexVC = $ this ->generateMML ( $ input );
28
+ $ this ->assertStringContainsString ( "<mstyle displaystyle= \"true \" scriptlevel= \"0 \"> " , $ mathMLtexVC );
29
+ }
30
+
31
+ public function testSumTextstyle () {
32
+ $ input = "\\textstyle \sum_{k=1}^N k^2 " ;
33
+ $ mathMLtexVC = $ this ->generateMML ( $ input );
34
+ $ this ->assertStringContainsString ( "<mstyle displaystyle= \"false \" scriptlevel= \"0 \"> " , $ mathMLtexVC );
35
+ }
36
+
24
37
public function testPilcrow () {
25
38
$ input = "\P " ;
26
39
$ mathMLtexVC = $ this ->generateMML ( $ input );
You can’t perform that action at this time.
0 commit comments