Tpt has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/370940 )
Change subject: Renders Index: pages without replying their Wikitext serialization ...................................................................... Renders Index: pages without replying their Wikitext serialization Change-Id: I3f3ffcae202a08acec55061dc07a20f033fa8d69 --- M includes/index/IndexContent.php 1 file changed, 24 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage refs/changes/40/370940/1 diff --git a/includes/index/IndexContent.php b/includes/index/IndexContent.php index 107915d..5fd0a01 100644 --- a/includes/index/IndexContent.php +++ b/includes/index/IndexContent.php @@ -4,7 +4,9 @@ use Content; use MagicWord; +use Parser; use ParserOptions; +use ParserOutput; use TextContent; use Title; use User; @@ -166,12 +168,29 @@ } /** - * @see Content::getParserOutput + * @see AbstractContent::fillParserOutput */ - public function getParserOutput( - Title $title, $revId = null, ParserOptions $options = null, $generateHtml = true + protected function fillParserOutput( Title $title, $revId, + ParserOptions $options, $generateHtml, ParserOutput &$output ) { - $wikitextContent = new WikitextContent( $this->serialize( CONTENT_FORMAT_WIKITEXT ) ); - return $wikitextContent->getParserOutput( $title, $revId, $options, $generateHtml ); + /** @var Parser $wgParser */ + global $wgParser; + + // We expand the index template + $wgParser->startExternalParse( $title, $options, Parser::OT_PREPROCESS ); + $frame = $wgParser->getPreprocessor()->newCustomFrame( array_map( function ( Content $content ) { + return $content->serialize( CONTENT_FORMAT_WIKITEXT ); + }, $this->fields ) ); + $templateTitle = Title::makeTitle( NS_MEDIAWIKI, 'Proofreadpage index template' ); + $templateText = $wgParser->fetchTemplate( $templateTitle ); + $dom = $wgParser->preprocessToDom( $templateText, Parser::PTD_FOR_INCLUSION ); + $text = $frame->expand( $dom ); + + // We do the final rendering + $output = $wgParser->parse( $text, $title, $options, true, true, $revId ); + $output->addTemplate( $templateTitle, + $templateTitle->getArticleID(), + $templateTitle->getLatestRevID() + ); } } -- To view, visit https://gerrit.wikimedia.org/r/370940 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3f3ffcae202a08acec55061dc07a20f033fa8d69 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ProofreadPage Gerrit-Branch: master Gerrit-Owner: Tpt <thoma...@hotmail.fr> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits