From e20e64eb6bd8b4c22491a1aebe2792618fd39ea2 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Sun, 2 Nov 2014 18:19:56 +0100 Subject: [PATCH] Parser: Add to the whitelist for TOC links Bug: 72884 Change-Id: Id5aa9a4eb32fb185881141e55de700ae36f806c5 --- includes/parser/Parser.php | 5 +++-- tests/parser/parserTests.txt | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index e3a4ea57eb..6b2444ebb5 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4636,14 +4636,15 @@ class Parser { # * and (bug 8393) # * (bug 26375) # * (r105284) + # * (bug 72884) # * and (bug 35167) # # We strip any parameter from accepted tags (second regex), except dir="rtl|ltr" from , # 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 diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index cf9d829975..7eb152ab8e 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -19043,6 +19043,22 @@ __TOC__ !! end +!! test +Bug 72884: bdi element in ToC +!! wikitext +__TOC__ +== test == +!! html +

Contents

+ +
+ +

test[edit]

+ +!! end + !! article MediaWiki:Bug32057 !! text -- 2.20.1