(bug 8393) <sup> and <sub> need to be preserved (without attributes) for entries...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 29 Aug 2007 00:06:58 +0000 (00:06 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 29 Aug 2007 00:06:58 +0000 (00:06 +0000)
RELEASE-NOTES
includes/Parser.php

index 4e645c2..c3ed0ed 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..b2256b1 100644 (file)
@@ -3641,12 +3641,20 @@ 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 );
+
                        # Save headline for section edit hint before it's escaped
                        $headline_hint = trim( $canonized_headline );
-                       $canonized_headline = Sanitizer::escapeId( $tocline );
+                       $canonized_headline = Sanitizer::escapeId( $canonized_headline );
                        $refers[$headlineCount] = $canonized_headline;
 
                        # count how many in assoc. array so we can track dupes in anchors