Merge "RCFilters: Don't apply/clear highlights 66 times"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 30 Sep 2017 02:09:46 +0000 (02:09 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 30 Sep 2017 02:09:46 +0000 (02:09 +0000)
includes/Sanitizer.php
includes/parser/Parser.php
tests/parser/parserTests.txt
tests/phpunit/includes/SanitizerTest.php

index a7f963a..4c99677 100644 (file)
@@ -824,7 +824,7 @@ class Sanitizer {
                                || $attribute === 'aria-labelledby'
                                || $attribute === 'aria-owns'
                        ) {
-                               $value = self::escapeIdReferenceList( $value, 'noninitial' );
+                               $value = self::escapeIdReferenceList( $value );
                        }
 
                        // RDFa and microdata properties allow URLs, URIs and/or CURIs.
@@ -1344,7 +1344,7 @@ class Sanitizer {
         * Given a string containing a space delimited list of ids, escape each id
         * to match ids escaped by the escapeId() function.
         *
-        * @todo wfDeprecated() uses of $options in 1.31, remove completely in 1.32
+        * @todo remove $options completely in 1.32
         *
         * @since 1.27
         *
@@ -1353,6 +1353,9 @@ class Sanitizer {
         * @return string
         */
        static function escapeIdReferenceList( $referenceString, $options = [] ) {
+               if ( $options ) {
+                       wfDeprecated( __METHOD__ . ' with $options', '1.31' );
+               }
                # Explode the space delimited list string into an array of tokens
                $references = preg_split( '/\s+/', "{$referenceString}", -1, PREG_SPLIT_NO_EMPTY );
 
index d00b333..49f2ce1 100644 (file)
@@ -2299,10 +2299,7 @@ class Parser {
                                        /**
                                         * Strip the whitespace interwiki links produce, see T10897
                                         */
-                                       $s = rtrim( $s . $prefix );
-                                       // Special case: strip newlines when only thing between
-                                       // this link and next are newlines
-                                       $s .= trim( $trail, "\n" ) === '' ? '' : $trail;
+                                       $s = rtrim( $s . $prefix ) . $trail; # T175416
                                        continue;
                                }
 
@@ -2330,10 +2327,7 @@ class Parser {
                                        /**
                                         * Strip the whitespace Category links produce, see T2087
                                         */
-                                       $s = rtrim( $s . $prefix ); # T2087, T87753
-                                       // Special case: strip newlines when only thing between
-                                       // this link and next are newlines
-                                       $s .= trim( $trail, "\n" ) === '' ? '' : $trail;
+                                       $s = rtrim( $s . $prefix ) . $trail; # T2087, T87753
 
                                        if ( $wasblank ) {
                                                $sortkey = $this->getDefaultSort();
index 0aa0e03..3c861ea 100644 (file)
@@ -16180,11 +16180,9 @@ parsoid=wt2html,html2html
 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
 !! end
 
-# NOTE that Parsoid does not currently implement this special case
-# (T175416).  The plan is to remove this weird special-case in the PHP
-# parser to make it match the Parsoid output.
+# Note that Parsoid differs slightly from PHP due to T175421
 !! test
-11. Special case where only newlines separate links
+11. Special case where only newlines separate links (T175416)
 !! options
 parsoid=wt2html,html2html
 !! wikitext
@@ -16194,7 +16192,9 @@ parsoid=wt2html,html2html
 
 [[Foo]]
 !! html/php
-<p><a href="/wiki/Foo" title="Foo">Foo</a><a href="/wiki/Foo" title="Foo">Foo</a>
+<p><br />
+<a href="/wiki/Foo" title="Foo">Foo</a>
+</p><p><a href="/wiki/Foo" title="Foo">Foo</a>
 </p>
 !! html/parsoid
 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
index 7256694..6fc25df 100644 (file)
@@ -388,7 +388,7 @@ class SanitizerTest extends MediaWikiTestCase {
         */
        public function testEscapeIdReferenceList( $referenceList, $id1, $id2 ) {
                $this->assertEquals(
-                       Sanitizer::escapeIdReferenceList( $referenceList, 'noninitial' ),
+                       Sanitizer::escapeIdReferenceList( $referenceList ),
                        Sanitizer::escapeIdForAttribute( $id1 )
                                . ' '
                                . Sanitizer::escapeIdForAttribute( $id2 )