Index: trunk/extensions/ExpandTemplates/ExpandTemplates_body.php |
— | — | @@ -41,8 +41,10 @@ |
42 | 42 | $wgOut->addWikiText( wfMsg( 'expand_templates_intro' ) ); |
43 | 43 | $wgOut->addHtml( $this->makeForm( $titleStr, $removeComments, $input ) ); |
44 | 44 | |
45 | | - if( $output ) |
| 45 | + if( $output ) { |
46 | 46 | $wgOut->addHtml( $this->makeOutput( $output ) ); |
| 47 | + $this->showHtmlPreview( $title, $output, $wgOut ); |
| 48 | + } |
47 | 49 | |
48 | 50 | } |
49 | 51 | |
— | — | @@ -82,6 +84,20 @@ |
83 | 85 | return $out; |
84 | 86 | } |
85 | 87 | |
| 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 | + |
86 | 102 | } |
87 | 103 | |
88 | 104 | ?> |
Index: trunk/extensions/ExpandTemplates/ExpandTemplates.i18n.php |
— | — | @@ -19,6 +19,7 @@ |
20 | 20 | 'expand_templates_output' => 'Result:', |
21 | 21 | 'expand_templates_ok' => 'OK', |
22 | 22 | 'expand_templates_remove_comments' => 'Remove comments', |
| 23 | + 'expand_templates_preview' => 'Preview', |
23 | 24 | ); |
24 | 25 | |
25 | 26 | $wgExpandTemplatesMessages['ar'] = array( |