Merge "Parser: Allow `<s>` and `<strike>` in table of contents"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 28 Sep 2016 21:31:33 +0000 (21:31 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 28 Sep 2016 21:31:33 +0000 (21:31 +0000)
1  2 
includes/parser/Parser.php
tests/parser/parserTests.txt

@@@ -251,7 -251,7 +251,7 @@@ class Parser 
        protected $mProfiler;
  
        /**
 -       * @var \MediaWiki\Linker\LinkRenderer
 +       * @var LinkRenderer
         */
        protected $mLinkRenderer;
  
        }
  
        /**
 -       * Get a \MediaWiki\Linker\LinkRenderer instance to make links with
 +       * Get a LinkRenderer instance to make links with
         *
         * @since 1.28
 -       * @return \MediaWiki\Linker\LinkRenderer
 +       * @return LinkRenderer
         */
        public function getLinkRenderer() {
                if ( !$this->mLinkRenderer ) {
                        # * <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
@@@ -20905,26 -20905,6 +20905,26 @@@ Id starting with underscor
  
  !! end
  
 +!! test
 +Edit comment with link with more than one pipe (T99346)
 +!! options
 +comment
 +!! wikitext
 +[[Main Page|Many|pipes]]
 +!! html
 +<a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
 +!! end
 +
 +!! test
 +Complex edit comment with link with more than one pipe (T99346)
 +!! options
 +comment
 +!! wikitext
 +Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
 +!! html
 +Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requests_for_permissions/Bot&amp;action=edit&amp;redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a>&lt;/noinclude&gt; === <a href="/index.php?title=User:MineoBot&amp;action=edit&amp;redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo...&quot;
 +!! end
 +
  !! test
  Space normalisation on autocomment (bug 22784)
  !! options
@@@ -21651,6 -21631,22 +21651,22 @@@ __TOC_
  
  !! 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&amp;action=edit&amp;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 (!).