diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index e3a4ea57eb3..6b2444ebb54 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 cf9d8299753..7eb152ab8ee 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