* Recursion loop check added to Categoryfinder class
* Fixed few performance troubles of large job queue processing
* Not setting various parameters in Foreign Repos now fails more gracefully
+* (bug 2333) Redirects are properly rendered when previewing an edit.
=== API changes in 1.14 ===
}
} else if ( $rt = Title::newFromRedirect( $text ) ) {
# Don't append the subtitle if this was an old revision
- $this->viewRedirect( $rt, !$wasRedirected && $this->isCurrent() );
+ $wgOut->addHTML( $this->viewRedirect( $rt, !$wasRedirected && $this->isCurrent() ) );
$parseout = $wgParser->parse($text, $this->mTitle, ParserOptions::newFromUser($wgUser));
$wgOut->addParserOutputNoText( $parseout );
} else if ( $pcache ) {
&& !$this->mTitle->isCssJsSubpage();
}
- protected function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) {
+ /**
+ * View redirect
+ * @param Title $target Title of destination to redirect
+ * @param Bool $appendSubtitle Object[optional]
+ * @param Bool $forceKnown Should the image be shown as a bluelink regardless of existence?
+ */
+ public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) {
global $wgParser, $wgOut, $wgContLang, $wgStylePath, $wgUser;
# Display redirect
else
$link = $sk->makeLinkObj( $target, htmlspecialchars( $target->getFullText() ) );
- $wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT " />' .
- '<span class="redirectText">'.$link.'</span>' );
+ return '<img src="'.$imageUrl.'" alt="#REDIRECT " />' .
+ '<span class="redirectText">'.$link.'</span>';
}
}
/**
- * @todo document
+ * Get the rendered text for previewing.
+ * @return string
*/
function getPreviewText() {
global $wgOut, $wgUser, $wgTitle, $wgParser, $wgLang, $wgContLang;
$parserOutput = $wgParser->parse( $previewtext , $this->mTitle, $parserOptions );
$wgOut->addHTML( $parserOutput->mText );
$previewHTML = '';
+ } else if( $rt = Title::newFromRedirect( $this->textbox1 ) ) {
+ $previewHTML = $this->mArticle->viewRedirect( $rt, false );
} else {
$toparse = $this->textbox1;
} else {
$previewfoot = '';
}
-
+
wfProfileOut( $fname );
return $previewhead . $previewHTML . $previewfoot;
}
// mTitle is not the same as the redirect target so it is
// probably the redirect page itself. Fake the redirect symbol
$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
- $this->viewRedirect( Title::makeTitle( NS_IMAGE, $this->img->getName() ),
- /* $appendSubtitle */ true, /* $forceKnown */ true );
+ $wgOut->addHTML( $this->viewRedirect( Title::makeTitle( NS_IMAGE, $this->img->getName() ),
+ /* $appendSubtitle */ true, /* $forceKnown */ true ) );
$this->viewUpdates();
return;
}