public function parseText($rawText) { global $wgEnableParserCache; $this->mRawtext = self::removeMetadataTag($rawText); $wgEnableParserCache = false; $parser = ParserPool::get(); $parser->ac_metadata = []; // VOLDEV-68: Remove broken section edit links $opts = ParserOptions::newFromContext(RequestContext::getMain()); $opts->setEditSection(false); $head = $parser->parse($rawText, $this->mTitle, $opts); $this->mText = wfFixMalformedHTML($head->getText()); $this->mHeadItems = $head->getHeadItems(); if (isset($parser->ac_metadata)) { $this->mMetadata = $parser->ac_metadata; } else { $this->mMetadata = []; } ParserPool::release($parser); return $this->mText; }
/** * Checking if wfFixMalformedHTML can deal with Russian Text * * @param string $testCaseName description of the testcase data * @param string $html HTML snippet with some Russian text, or Russian text with unmatched tags * @param string $expected fixed HTML markup we're expecting to get * @dataProvider russianTextDataProvider */ function testRussianText($testCaseName, $html, $expected) { $this->assertEquals($expected, str_replace("\n", "", wfFixMalformedHTML($html)), $testCaseName); }