Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4107466
MathMLRdfBuilder.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
MathMLRdfBuilder.php
View Options
<?php
namespace
MediaWiki\Extension\Math
;
use
Wikibase\DataModel\Snak\PropertyValueSnak
;
use
Wikibase\Repo\Rdf\ValueSnakRdfBuilder
;
use
Wikimedia\Purtle\RdfWriter
;
class
MathMLRdfBuilder
implements
ValueSnakRdfBuilder
{
/**
* Adds a value
*
* @param RdfWriter $writer
* @param string $propertyValueNamespace Property value relation namespace
* @param string $propertyValueLName Property value relation name
* @param string $dataType Property data type
* @param string $snakNamespace
* @param PropertyValueSnak $snak
*/
public
function
addValue
(
RdfWriter
$writer
,
$propertyValueNamespace
,
$propertyValueLName
,
$dataType
,
$snakNamespace
,
PropertyValueSnak
$snak
)
{
$renderer
=
new
MathNativeMML
(
$snak
->
getDataValue
()->
getValue
()
);
if
(
$renderer
->
checkTeX
()
&&
$renderer
->
render
()
)
{
$mml
=
$renderer
->
getMathml
();
}
else
{
$err
=
$renderer
->
getLastError
();
$mml
=
"<math xmlns=
\"
http://www.w3.org/1998/Math/MathML
\"
><merror>$err</merror></math>"
;
}
$writer
->
say
(
$propertyValueNamespace
,
$propertyValueLName
)
->
value
(
$mml
,
'http://www.w3.org/1998/Math/MathML'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 20:04 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
79/ac/0f235c139258661a96a36cd6227c
Default Alt Text
MathMLRdfBuilder.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment