Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4097677
Declh.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Declh.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Extension\Math\WikiTexVC\Nodes
;
class
Declh
extends
TexNode
{
/** @var string */
private
$fname
;
/** @var TexArray */
private
$arg
;
public
function
__construct
(
string
$fname
,
TexArray
$arg
)
{
parent
::
__construct
(
$fname
,
$arg
);
$this
->
fname
=
$fname
;
$this
->
arg
=
$arg
;
}
/**
* @return string
*/
public
function
getFname
():
string
{
return
$this
->
fname
;
}
/**
* @return TexArray
*/
public
function
getArg
():
TexArray
{
return
$this
->
arg
;
}
/** @inheritDoc */
public
function
inCurlies
()
{
return
$this
->
render
();
}
/** @inheritDoc */
public
function
render
()
{
return
'{'
.
$this
->
fname
.
' '
.
$this
->
arg
->
inCurlies
()
.
'}'
;
}
/** @inheritDoc */
public
function
renderMML
(
$arguments
=
[],
&
$state
=
[]
)
{
return
$this
->
parseToMML
(
$this
->
fname
,
$arguments
,
null
);
}
/** @inheritDoc */
public
function
extractIdentifiers
(
$args
=
null
)
{
if
(
$args
==
null
)
{
$args
=
[
$this
->
arg
];
}
$identifier
=
parent
::
extractIdentifiers
(
$args
);
if
(
isset
(
$identifier
[
0
]
)
)
{
return
[
implode
(
''
,
$identifier
)
];
}
return
$identifier
;
}
/** @inheritDoc */
public
function
extractSubscripts
()
{
$f
=
$this
->
fname
;
// @see
// http://tex.stackexchange.com/questions/98406/which-command-should-i-use-for-textual-subscripts-in-math-mode
// cf https://phabricator.wikimedia.org/T56818 a is always RM
// for f there are only four cases
switch
(
$f
)
{
case
'
\\
rm'
:
$f
=
'
\\
mathrm'
;
break
;
case
'
\\
it'
:
$f
=
'
\\
mathit'
;
break
;
case
'
\\
cal'
:
$f
=
'
\\
mathcal'
;
break
;
case
'
\\
bf'
:
$f
=
'
\\
mathbf'
;
}
$x
=
$this
->
arg
->
extractSubscripts
();
if
(
isset
(
$x
[
0
]
)
)
{
return
[
$f
.
'{'
.
$x
.
'}'
];
}
return
parent
::
extractSubscripts
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 15:00 (3 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
71/24/a115e58c7f60f2a58a2a0f843209
Default Alt Text
Declh.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment