From ab3a00a097a46c81be1bcd5fed02163f981020e4 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Wed, 29 Aug 2007 00:06:58 +0000 Subject: [PATCH] (bug 8393) and need to be preserved (without attributes) for entries in the table of contents. --- RELEASE-NOTES | 2 ++ includes/Parser.php | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4e645c2a2e..c3ed0eda80 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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) and need to be preserved (without attributes) for + entries in the table of contents == API changes since 1.10 == diff --git a/includes/Parser.php b/includes/Parser.php index af358cd9e1..b2256b1a76 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -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 and : 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 -- 2.20.1