Reinstate r25260 with fix (missing trim()). No additional parser tests are broken...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 29 Aug 2007 16:10:36 +0000 (16:10 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 29 Aug 2007 16:10:36 +0000 (16:10 +0000)
RELEASE-NOTES
includes/Parser.php

index ce6666a..832aa75 100644 (file)
@@ -424,6 +424,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 11072) Fix regression in API image history query
 * (bug 10985) Resolved cached entries on Special:DoubleRedirects were being
   supressed, breaking paging - now strikes out "fixed" results
+* (bug 8393) <sup> and <sub> need to be preserved (without attributes) for
+  entries in the table of contents
 
 == API changes since 1.10 ==
 
index af358cd..32e7f2a 100644 (file)
@@ -3641,12 +3641,21 @@ class Parser
                                                            "\$this->mInterwikiLinkHolders['texts'][\$1]",
                                                            $canonized_headline );
 
-                       # strip out HTML
-                       $canonized_headline = preg_replace( '/<.*?' . '>/','',$canonized_headline );
-                       $tocline = trim( $canonized_headline );
+                       # Strip out HTML (other than plain <sup> and <sub>: bug 8393)
+                       $tocline = preg_replace(
+                               array( '#<(?!/?(sup|sub)).*?'.'>#', '#<(/?(sup|sub)).*?'.'>#' ),
+                               array( '',                          '<$1>'),
+                               $canonized_headline
+                       );
+                       $tocline = trim( $tocline );
+
+                       # For the anchor, strip out HTML-y stuff period
+                       $canonized_headline = preg_replace( '/<.*?'.'>/', '', $canonized_headline );
+                       $canonized_headline = trim( $canonized_headline );
+
                        # Save headline for section edit hint before it's escaped
-                       $headline_hint = trim( $canonized_headline );
-                       $canonized_headline = Sanitizer::escapeId( $tocline );
+                       $headline_hint = $canonized_headline;
+                       $canonized_headline = Sanitizer::escapeId( $canonized_headline );
                        $refers[$headlineCount] = $canonized_headline;
 
                        # count how many in assoc. array so we can track dupes in anchors