Parser: Add <bdi> to the whitelist for TOC links

Bug: 72884
Change-Id: Id5aa9a4eb32fb185881141e55de700ae36f806c5
This commit is contained in:
Derk-Jan Hartman 2014-11-02 18:19:56 +01:00
parent 61e23c0578
commit e20e64eb6b
2 changed files with 19 additions and 2 deletions

View file

@ -4636,14 +4636,15 @@ class Parser {
# * <sup> and <sub> (bug 8393)
# * <i> (bug 26375)
# * <b> (r105284)
# * <bdi> (bug 72884)
# * <span dir="rtl"> and <span dir="ltr"> (bug 35167)
#
# We strip any parameter from accepted tags (second regex), except dir="rtl|ltr" from <span>,
# to allow setting directionality in toc items.
$tocline = preg_replace(
array(
'#<(?!/?(span|sup|sub|i|b)(?: [^>]*)?>).*?' . '>#',
'#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|i|b))(?: .*?)?' . '>#'
'#<(?!/?(span|sup|sub|bdi|i|b)(?: [^>]*)?>).*?' . '>#',
'#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b))(?: .*?)?' . '>#'
),
array( '', '<$1>' ),
$safeHeadline

View file

@ -19043,6 +19043,22 @@ __TOC__
!! end
!! test
Bug 72884: bdi element in ToC
!! wikitext
__TOC__
== <bdi>test</bdi> ==
!! html
<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
</ul>
</div>
<h2><span class="mw-headline" id="test"><bdi>test</bdi></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
!! end
!! article
MediaWiki:Bug32057
!! text