setMode( MathConfig::MODE_NATIVE_MML ); $this->setPurge(); } protected function doRender(): StatusValue { $presentation = $this->getChecker()->getPresentationMathMLFragment(); $config = MediaWikiServices::getInstance()->getMainConfig(); $attributes = [ 'class' => 'mwe-math-element' ]; if ( $this->getID() !== '' ) { $attributes['id'] = $this->getID(); } if ( $config->get( 'MathEnableFormulaLinks' ) && isset( $this->params['qid'] ) && preg_match( '/Q\d+/', $this->params['qid'] ) ) { $titleObj = Title::newFromLinkTarget( SpecialPage::getTitleValueFor( 'MathWikibase' ) ); $attributes['href'] = $titleObj->getLocalURL( [ 'qid' => $this->params['qid'] ] ); } if ( $this->getMathStyle() == 'display' ) { $attributes['display'] = 'block'; } $root = new MMLmath( "", $attributes ); $this->setMathml( $root->encapsulateRaw( $presentation ) ); return StatusValue::newGood(); } protected function getChecker(): LocalChecker { $this->checker ??= Math::getCheckerFactory() ->newLocalChecker( $this->tex, $this->getInputType() ); return $this->checker; } /** * @inheritDoc */ public function getHtmlOutput(): string { return $this->getMathml(); } }