r77003 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77002‎ | r77003 | r77004 >
Date:02:01, 19 November 2010
Author:hartman
Status:ok
Tags:
Comment:
ExpandTemplates: Tidy HTML preview. Fixes bug 25888
Modified paths:
  • /trunk/extensions/ExpandTemplates/ExpandTemplates_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ExpandTemplates/ExpandTemplates_body.php
@@ -30,6 +30,7 @@
3131 $this->removeNowiki = $wgRequest->getBool( 'removenowiki', false );
3232 $options = new ParserOptions;
3333 $options->setRemoveComments( $this->removeComments );
 34+ $options->setTidy( true );
3435 $options->setMaxIncludeSize( self::MAX_INCLUDE_SIZE );
3536 if ( $this->generateXML ) {
3637 $wgParser->startExternalParse( $title, $options, OT_PREPROCESS );
@@ -51,6 +52,8 @@
5253 $wgOut->addHTML( $this->makeForm( $titleStr, $input ) );
5354
5455 if( $output !== false ) {
 56+ global $wgUseTidy, $wgAlwaysUseTidy;
 57+
5558 if ( $this->generateXML ) {
5659 $wgOut->addHTML( $this->makeOutput( $xml, 'expand_templates_xml_output' ) );
5760 }
@@ -58,6 +61,9 @@
5962 if ( $this->removeNowiki ) {
6063 $tmp = preg_replace( array( '_<nowiki>_', '_</nowiki>_', '_<nowiki */>_' ), '', $tmp );
6164 }
 65+ if( ( $wgUseTidy && $options->getTidy() ) || $wgAlwaysUseTidy ) {
 66+ $tmp = MWTidy::tidy( $tmp );
 67+ }
6268 $wgOut->addHTML( $tmp );
6369 $this->showHtmlPreview( $title, $output, $wgOut );
6470 }

Status & tagging log