From: Fran Rogers Date: Mon, 20 Oct 2008 06:46:09 +0000 (+0000) Subject: Convert literal tabs to when passing them through Tidy, to prevent them from... X-Git-Tag: 1.31.0-rc.0~44671 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=7c1712c550b3dba8ae00a6a4a370751efa38c442;p=lhc%2Fweb%2Fwiklou.git Convert literal tabs to when passing them through Tidy, to prevent them from being clobbered. --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 0d3d5179b1..561283a6c1 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -665,9 +665,14 @@ class Parser */ function tidy( $text ) { global $wgTidyInternal; + $wrappedtext = ''. 'test'.$text.''; + + # Tidy is known to clobber tabs; convert 'em to entities + $wrappedtext = str_replace("\t", ' ', $wrappedtext); + if( $wgTidyInternal ) { $correctedtext = self::internalTidy( $wrappedtext ); } else { @@ -677,6 +682,10 @@ class Parser wfDebug( "Tidy error detected!\n" ); return $text . "\n\n"; } + + # Convert the tabs back from entities + $correctedtext = str_replace(' ', "\t", $correctedtext); + return $correctedtext; }