diff --git a/services/Parser/ExternalParser.php b/services/Parser/ExternalParser.php index 8d072e0..a8b73b5 100644 --- a/services/Parser/ExternalParser.php +++ b/services/Parser/ExternalParser.php @@ -2,8 +2,6 @@ namespace Wikia\PortableInfobox\Parser; interface ExternalParser { - public function parse( $text ); - public function parseRecursive( $text ); public function replaceVariables( $text ); diff --git a/services/Parser/MediaWikiParserService.php b/services/Parser/MediaWikiParserService.php index 21f3352..96fa998 100644 --- a/services/Parser/MediaWikiParserService.php +++ b/services/Parser/MediaWikiParserService.php @@ -12,28 +12,6 @@ class MediaWikiParserService implements ExternalParser { $this->frame = $frame; } - /** - * Method used for parsing wikitext provided through variable - * - * @param $wikitext - * - * @return mixed - */ - public function parse( $wikitext ) { - wfProfileIn( __METHOD__ ); - if ( in_array( substr( $wikitext, 0, 1 ), [ '*', '#' ] ) ) { - //fix for first item list elements - $wikitext = "\n" . $wikitext; - } - $parsed = $this->parser->internalParse( $wikitext, false, $this->frame ); - $output = $this->parser->doBlockLevels( $parsed, false ); - $this->parser->replaceLinkHolders( $output ); - - wfProfileOut( __METHOD__ ); - - return $output; - } - /** * Method used for parsing wikitext provided in infobox that might contain variables * @@ -43,8 +21,14 @@ class MediaWikiParserService implements ExternalParser { */ public function parseRecursive( $wikitext ) { wfProfileIn( __METHOD__ ); - $parsed = $this->parse( $wikitext ); - $ready = $this->parser->mStripState->unstripBoth( $parsed ); + if ( in_array( substr( $wikitext, 0, 1 ), [ '*', '#' ] ) ) { + //fix for first item list elements + $wikitext = "\n" . $wikitext; + } + $parsed = $this->parser->internalParse( $wikitext, false, $this->frame ); + $output = $this->parser->doBlockLevels( $parsed, false ); + $ready = $this->parser->mStripState->unstripBoth( $output ); + $this->parser->replaceLinkHolders( $ready ); $newlinesstripped = preg_replace( '|[\n\r]|Us', '', $ready ); $marksstripped = preg_replace( '|{{{.*}}}|Us', '', $newlinesstripped ); wfProfileOut( __METHOD__ ); diff --git a/services/Parser/SimpleParser.php b/services/Parser/SimpleParser.php index 996e380..24df692 100644 --- a/services/Parser/SimpleParser.php +++ b/services/Parser/SimpleParser.php @@ -2,12 +2,8 @@ namespace Wikia\PortableInfobox\Parser; class SimpleParser implements ExternalParser { - public function parse( $text ) { - return $text; - } - public function parseRecursive( $text ) { - return $this->parse( $text ); + return $text; } public function replaceVariables( $text ) {