Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4105515
FQ.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
FQ.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Extension\Math\WikiTexVC\Nodes
;
use
MediaWiki\Extension\Math\WikiTexVC\MMLmappings\BaseParsing
;
use
MediaWiki\Extension\Math\WikiTexVC\MMLnodes\MMLmrow
;
use
MediaWiki\Extension\Math\WikiTexVC\MMLnodes\MMLmstyle
;
use
MediaWiki\Extension\Math\WikiTexVC\MMLnodes\MMLmsubsup
;
use
MediaWiki\Extension\Math\WikiTexVC\MMLnodes\MMLmunderover
;
use
MediaWiki\Extension\Math\WikiTexVC\TexUtil
;
class
FQ
extends
TexNode
{
/** @var TexNode */
private
$base
;
/** @var TexNode */
private
$up
;
/** @var TexNode */
private
$down
;
public
function
__construct
(
TexNode
$base
,
TexNode
$down
,
TexNode
$up
)
{
parent
::
__construct
(
$base
,
$down
,
$up
);
$this
->
base
=
$base
;
$this
->
up
=
$up
;
$this
->
down
=
$down
;
}
/**
* @return TexNode
*/
public
function
getBase
():
TexNode
{
return
$this
->
base
;
}
/**
* @return TexNode
*/
public
function
getUp
():
TexNode
{
return
$this
->
up
;
}
/**
* @return TexNode
*/
public
function
getDown
():
TexNode
{
return
$this
->
down
;
}
/** @inheritDoc */
public
function
render
()
{
return
$this
->
base
->
render
()
.
'_'
.
$this
->
down
->
inCurlies
()
.
'^'
.
$this
->
up
->
inCurlies
();
}
/** @inheritDoc */
public
function
renderMML
(
$arguments
=
[],
&
$state
=
[]
)
{
if
(
array_key_exists
(
"limits"
,
$state
)
)
{
// A specific FQ case with preceding limits, just invoke the limits parsing manually.
return
BaseParsing
::
limits
(
$this
,
$arguments
,
$state
,
""
);
}
$base
=
$this
->
getBase
();
if
(
$base
->
getLength
()
==
0
&&
!
$base
->
isCurly
()
)
{
// this happens when FQ is located in Sideset (is this a common parsing way?)
$mrow
=
new
MMLmrow
();
return
$mrow
->
encapsulateRaw
(
$this
->
getDown
()->
renderMML
(
[],
$state
)
)
.
$mrow
->
encapsulateRaw
(
$this
->
getUp
()->
renderMML
(
[],
$state
)
);
}
$melement
=
new
MMLmsubsup
();
// tbd check for more such cases like TexUtilTest 317
if
(
$base
instanceof
Literal
)
{
$litArg
=
trim
(
$base
->
getArgs
()[
0
]
);
$tu
=
TexUtil
::
getInstance
();
// "sum", "bigcap", "bigcup", "prod" ... all are nullary macros.
if
(
$tu
->
nullary_macro
(
$litArg
)
&&
!
$tu
->
is_literal
(
$litArg
)
&&
// by default (inline-displaystyle large operators should be used)
(
$state
[
'styleargs'
][
'displaystyle'
]
??
'true'
)
===
'true'
)
{
$melement
=
new
MMLmunderover
();
}
}
$mrow
=
new
MMLmrow
();
$emptyMrow
=
""
;
// In cases with empty curly preceding like: "{}_1^2\!\Omega_3^4"
if
(
$base
->
isCurly
()
&&
$base
->
isEmpty
()
)
{
$emptyMrow
=
$mrow
->
getEmpty
();
}
// This seems to be the common case
$inner
=
$melement
->
encapsulateRaw
(
$emptyMrow
.
$base
->
renderMML
(
[],
$state
)
.
$mrow
->
encapsulateRaw
(
$this
->
getDown
()->
renderMML
(
$arguments
,
$state
)
)
.
$mrow
->
encapsulateRaw
(
$this
->
getUp
()->
renderMML
(
$arguments
,
$state
)
)
);
if
(
$melement
instanceof
MMLmunderover
)
{
$args
=
$state
[
'styleargs'
]
??
[
"displaystyle"
=>
"true"
,
"scriptlevel"
=>
0
];
$style
=
new
MMLmstyle
(
""
,
$args
);
return
$style
->
encapsulateRaw
(
$inner
);
}
return
$inner
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 19:01 (2 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
52/1e/a482548dfd3f6bb28a7e5ad336a3
Default Alt Text
FQ.php (3 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment