allow bold in TOC lines
authorAntoine Musso <hashar@users.mediawiki.org>
Tue, 6 Dec 2011 10:50:47 +0000 (10:50 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Tue, 6 Dec 2011 10:50:47 +0000 (10:50 +0000)
just like r102179 allowed italics in TOC lines for bug 26375, this
patch allow bold text as well.

includes/parser/Parser.php
tests/parser/parserTests.txt

index 881133b..a3748e1 100644 (file)
@@ -4051,7 +4051,7 @@ class Parser {
 
                        # Strip out HTML (other than plain <sup> and <sub>: bug 8393, or <i>: bug 26375)
                        $tocline = preg_replace(
-                               array( '#<(?!/?(sup|sub|i)).*?'.'>#', '#<(/?(sup|sub|i)).*?'.'>#' ),
+                               array( '#<(?!/?(sup|sub|i|b)).*?'.'>#', '#<(/?(sup|sub|i|b)).*?'.'>#' ),
                                array( '',                          '<$1>' ),
                                $safeHeadline
                        );
index 6fea871..e5688bf 100644 (file)
@@ -8957,6 +8957,23 @@ __TOC__
 
 !! end
 
+!! test
+Bug 26375: TOC with bold 
+!! options
+title=[[Main Page]]
+!! input
+__TOC__
+== '''should be bold''' then normal text ==
+!! result
+<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
+</ul>
+</td></tr></table>
+<h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a>]</span> <span class="mw-headline" id="should_be_bold_then_normal_text"> <b>should be bold</b> then normal text </span></h2>
+
+!! end
+
 !! article
 MediaWiki:Bug32057
 !! text