From 7c1712c550b3dba8ae00a6a4a370751efa38c442 Mon Sep 17 00:00:00 2001 From: Fran Rogers Date: Mon, 20 Oct 2008 06:46:09 +0000 Subject: [PATCH] Convert literal tabs to when passing them through Tidy, to prevent them from being clobbered. --- includes/parser/Parser.php | 9 +++++++++ 1 file changed, 9 insertions(+) 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; } -- 2.20.1