Special:ExpandTemplates: Load RL modules

Bug: 39049
Change-Id: I85d0c820d7fb5e3faa0081bf2e8e4672f2887b38
This commit is contained in:
Derk-Jan Hartman 2014-05-05 02:08:10 +02:00
parent 3fd9ff66f5
commit 5573d65bcf

View file

@ -118,13 +118,13 @@ class SpecialExpandTemplates extends SpecialPage {
$out->addHTML( $tmp ); $out->addHTML( $tmp );
$rawhtml = $this->generateHtml( $title, $output ); $pout = $this->generateHtml( $title, $output );
$rawhtml = $pout->getText();
if ( $this->generateRawHtml && strlen( $rawhtml ) > 0 ) { if ( $this->generateRawHtml && strlen( $rawhtml ) > 0 ) {
$out->addHTML( $this->makeOutput( $rawhtml, 'expand_templates_html_output' ) ); $out->addHTML( $this->makeOutput( $rawhtml, 'expand_templates_html_output' ) );
} }
$this->showHtmlPreview( $title, $rawhtml, $out ); $this->showHtmlPreview( $title, $pout, $out );
} }
} }
@ -222,26 +222,24 @@ class SpecialExpandTemplates extends SpecialPage {
* *
* @param Title $title * @param Title $title
* @param string $text * @param string $text
* @return string * @return ParserOutput
*/ */
private function generateHtml( Title $title, $text ) { private function generateHtml( Title $title, $text ) {
global $wgParser; global $wgParser;
$popts = ParserOptions::newFromContext( $this->getContext() ); $popts = ParserOptions::newFromContext( $this->getContext() );
$popts->setTargetLanguage( $title->getPageLanguage() ); $popts->setTargetLanguage( $title->getPageLanguage() );
$pout = $wgParser->parse( $text, $title, $popts ); return $wgParser->parse( $text, $title, $popts );
return $pout->getText();
} }
/** /**
* Wraps the provided html code in a div and outputs it to the page * Wraps the provided html code in a div and outputs it to the page
* *
* @param Title $title * @param Title $title
* @param string $html * @param ParserOutput $pout
* @param OutputPage $out * @param OutputPage $out
*/ */
private function showHtmlPreview( Title $title, $html, OutputPage $out ) { private function showHtmlPreview( Title $title, ParserOutput $pout, OutputPage $out ) {
$lang = $title->getPageViewLanguage(); $lang = $title->getPageViewLanguage();
$out->addHTML( "<h2>" . $this->msg( 'expand_templates_preview' )->escaped() . "</h2>\n" ); $out->addHTML( "<h2>" . $this->msg( 'expand_templates_preview' )->escaped() . "</h2>\n" );
$out->addHTML( Html::openElement( 'div', array( $out->addHTML( Html::openElement( 'div', array(
@ -249,7 +247,7 @@ class SpecialExpandTemplates extends SpecialPage {
'dir' => $lang->getDir(), 'dir' => $lang->getDir(),
'lang' => $lang->getHtmlCode(), 'lang' => $lang->getHtmlCode(),
) ) ); ) ) );
$out->addHTML( $html ); $out->addParserOutputContent( $pout );
$out->addHTML( Html::closeElement( 'div' ) ); $out->addHTML( Html::closeElement( 'div' ) );
} }