Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -665,9 +665,14 @@ |
666 | 666 | */ |
667 | 667 | function tidy( $text ) { |
668 | 668 | global $wgTidyInternal; |
| 669 | + |
669 | 670 | $wrappedtext = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'. |
670 | 671 | ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>'. |
671 | 672 | '<head><title>test</title></head><body>'.$text.'</body></html>'; |
| 673 | + |
| 674 | + # Tidy is known to clobber tabs; convert 'em to entities |
| 675 | + $wrappedtext = str_replace("\t", '	', $wrappedtext); |
| 676 | + |
672 | 677 | if( $wgTidyInternal ) { |
673 | 678 | $correctedtext = self::internalTidy( $wrappedtext ); |
674 | 679 | } else { |
— | — | @@ -677,6 +682,10 @@ |
678 | 683 | wfDebug( "Tidy error detected!\n" ); |
679 | 684 | return $text . "\n<!-- Tidy found serious XHTML errors -->\n"; |
680 | 685 | } |
| 686 | + |
| 687 | + # Convert the tabs back from entities |
| 688 | + $correctedtext = str_replace('	', "\t", $correctedtext); |
| 689 | + |
681 | 690 | return $correctedtext; |
682 | 691 | } |
683 | 692 | |