From: Brad Jorsch Date: Mon, 2 Jul 2018 15:17:06 +0000 (-0400) Subject: Parser: Remove style and script tags' content from TOC X-Git-Tag: 1.34.0-rc.0~4749 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=d469f538474b5c860e3984a9c4b672faaa305b1f;p=lhc%2Fweb%2Fwiklou.git Parser: Remove style and script tags' content from TOC We don't want to display the stylesheet as part of the TOC entry if someone uses TemplateStyles in a heading. Bug: T198618 Change-Id: I2f7316daaba0cce662b6a4702ab87322e6783655 --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index fd5ccb848b..12d899bc34 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4216,6 +4216,13 @@ class Parser { # Avoid insertion of weird stuff like by expanding the relevant sections $safeHeadline = $this->mStripState->unstripBoth( $safeHeadline ); + # Remove any (T10393) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index e2da66282e..b1510029a1 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -24710,6 +24710,27 @@ __TOC__

test test test

!! end +!! test +T198618: style element in ToC +!! options +styletag=1 +!! wikitext +__TOC__ +==Style== +!! html/php +

Contents

+ +
+ +

Style[edit]

+ +!! html/parsoid + +

Style

+!! end + !! test Empty

tag in TOC, removed by Sanitizer (T92892) !! wikitext