From 426c6414412e478a345f6627b2be071d010dcaaa Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sun, 1 Jan 2006 20:08:08 +0000 Subject: [PATCH] fix for broken categories on preview --- includes/EditPage.php | 6 ++---- includes/OutputPage.php | 18 +++++++++--------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index a83b20a5d5..7261751fd3 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1116,10 +1116,8 @@ END $parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $toparse ) ."\n\n", $wgTitle, $parserOptions ); - $previewHTML = $parserOutput->mText; - - $wgOut->addCategoryLinks($parserOutput->getCategoryLinks()); - $wgOut->addLanguageLinks($parserOutput->getLanguageLinks()); + $previewHTML = $parserOutput->getText(); + $wgOut->addParserOutputNoText( $parserOutput ); wfProfileOut( $fname ); return $previewhead . $previewHTML; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 3d464f4132..9978a31799 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -286,12 +286,20 @@ class OutputPage { global $wgParser; $parserOutput = $wgParser->parse( $text, $title, $this->mParserOptions, $linestart, true, $this->mRevisionId ); + $this->addParserOutput( $parserOutput ); + } + + function addParserOutputNoText( &$parserOutput ) { $this->mLanguageLinks += $parserOutput->getLanguageLinks(); $this->addCategoryLinks( $parserOutput->getCategories() ); $this->addKeywords( $parserOutput ); if ( $parserOutput->getCacheTime() == -1 ) { $this->enableClientCache( false ); } + } + + function addParserOutput( &$parserOutput ) { + $this->addParserOutputNoText( $parserOutput ); $this->addHTML( $parserOutput->getText() ); } @@ -305,19 +313,11 @@ class OutputPage { $parserOutput = $wgParser->parse( $text, $article->mTitle, $this->mParserOptions, true, true, $this->mRevisionId ); - $text = $parserOutput->getText(); - if ( $article && $parserOutput->getCacheTime() != -1 ) { $wgParserCache->save( $parserOutput, $article, $wgUser ); } - $this->mLanguageLinks += $parserOutput->getLanguageLinks(); - $this->addCategoryLinks( $parserOutput->getCategories() ); - $this->addKeywords( $parserOutput ); - if ( $parserOutput->getCacheTime() == -1 ) { - $this->enableClientCache( false ); - } - $this->addHTML( $text ); + $this->addParserOutput( $parserOutput ); } /** -- 2.20.1