jenkins-bot has submitted this change and it was merged. Change subject: Parser: Allow `<s>` and `<strike>` in table of contents ......................................................................
Parser: Allow `<s>` and `<strike>` in table of contents Bug: T35715 Change-Id: Iec6a05e3e6bb622f477e6ebeb57e9f65da5f22bd --- M includes/parser/Parser.php M tests/parser/parserTests.txt 2 files changed, 19 insertions(+), 2 deletions(-) Approvals: Subramanya Sastry: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 7c18798..c4149b0 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4138,12 +4138,13 @@ # * <b> (r105284) # * <bdi> (bug 72884) # * <span dir="rtl"> and <span dir="ltr"> (bug 35167) + # * <s> and <strike> (T35715) # 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( [ - '#<(?!/?(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 2c8b163..80a78f0 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -21631,6 +21631,22 @@ !! end +!! test +T35715: s/strike element in ToC +!! wikitext +__TOC__ +== <s>test</s> test <strike>test</strike> == +!! html +<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div> +<ul> +<li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li> +</ul> +</div> + +<h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: test test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2> + +!! end + # Note that the html output does not have the <p></p>, but the # html+tidy output *does*. This is because the empty <p></p> is # removed by the sanitizer, but only when tidy is *not* enabled (!). -- To view, visit https://gerrit.wikimedia.org/r/312093 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iec6a05e3e6bb622f477e6ebeb57e9f65da5f22bd Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Bartosz DziewoĆski <matma....@gmail.com> Gerrit-Reviewer: C. Scott Ananian <canan...@wikimedia.org> Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits