r23441 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23440‎ | r23441 | r23442 >
Date:21:45, 26 June 2007
Author:robchurch
Status:old
Tags:
Comment:
(bug 7172) Add HTML preview to Special:ExpandTemplates
Modified paths:
  • /trunk/extensions/ExpandTemplates/ExpandTemplates.i18n.php (modified) (history)
  • /trunk/extensions/ExpandTemplates/ExpandTemplates_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ExpandTemplates/ExpandTemplates_body.php
@@ -41,8 +41,10 @@
4242 $wgOut->addWikiText( wfMsg( 'expand_templates_intro' ) );
4343 $wgOut->addHtml( $this->makeForm( $titleStr, $removeComments, $input ) );
4444
45 - if( $output )
 45+ if( $output ) {
4646 $wgOut->addHtml( $this->makeOutput( $output ) );
 47+ $this->showHtmlPreview( $title, $output, $wgOut );
 48+ }
4749
4850 }
4951
@@ -82,6 +84,20 @@
8385 return $out;
8486 }
8587
 88+ /**
 89+ * Render the supplied wiki text and append to the page as a preview
 90+ *
 91+ * @param Title $title
 92+ * @param string $text
 93+ * @param OutputPage $out
 94+ */
 95+ private function showHtmlPreview( $title, $text, $out ) {
 96+ global $wgParser;
 97+ $pout = $wgParser->parse( $text, $title, new ParserOptions() );
 98+ $out->addHtml( "<h2>" . wfMsgHtml( 'expand_templates_preview' ) . "</h2>\n" );
 99+ $out->addHtml( $pout->getText() );
 100+ }
 101+
86102 }
87103
88104 ?>
Index: trunk/extensions/ExpandTemplates/ExpandTemplates.i18n.php
@@ -19,6 +19,7 @@
2020 'expand_templates_output' => 'Result:',
2121 'expand_templates_ok' => 'OK',
2222 'expand_templates_remove_comments' => 'Remove comments',
 23+ 'expand_templates_preview' => 'Preview',
2324 );
2425
2526 $wgExpandTemplatesMessages['ar'] = array(

Status & tagging log