From c60e85c4dcbd5e60b65875d1ed9e546b6682f46d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Wed, 21 Sep 2016 21:59:56 +0200 Subject: [PATCH] Parser: Allow `` and `` in table of contents Bug: T35715 Change-Id: Iec6a05e3e6bb622f477e6ebeb57e9f65da5f22bd --- 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 7c18798f2e..c4149b0c29 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4138,12 +4138,13 @@ class Parser { # * (r105284) # * (bug 72884) # * and (bug 35167) + # * and (T35715) # We strip any parameter from accepted tags (second regex), except dir="rtl|ltr" from , # to allow setting directionality in toc items. $tocline = preg_replace( [ - '#<(?!/?(span|sup|sub|bdi|i|b)(?: [^>]*)?>).*?>#', - '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b))(?: .*?)?>#' + '#<(?!/?(span|sup|sub|bdi|i|b|s|strike)(?: [^>]*)?>).*?>#', + '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b|s|strike))(?: .*?)?>#' ], [ '', '<$1>' ], $safeHeadline diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 2c8b163a5f..80a78f009d 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -21631,6 +21631,22 @@ __TOC__ !! end +!! test +T35715: s/strike element in ToC +!! wikitext +__TOC__ +== test test test == +!! html +

Contents

+ +
+ +

test test test[edit]

+ +!! end + # Note that the html output does not have the

, but the # html+tidy output *does*. This is because the empty

is # removed by the sanitizer, but only when tidy is *not* enabled (!). -- 2.20.1