jenkins-bot has submitted this change and it was merged.

Change subject: Followup on 6e335639: Better suppression of spurious <nowiki/>s
......................................................................


Followup on 6e335639: Better suppression of spurious <nowiki/>s

* The regexp testing for nowiki was not properly testing for
  an intervening white-space that acts as a boundary for the regexp.

* Updated an existing parser test that fails without this patch.

* Pages that saw dirty diffs in RT testing are now clean:
  - http://localhost:8000/_rt/dewiki/Gertrude_Schoepperle
  - http://localhost:8000/_rt/eswiki/Amolops_chunganensis
  - http://localhost:8000/_rt/enwiki/Alberta_Forest_Products_Association

Change-Id: I7f0bd2fff3d7fc96ed1042644c097bfc6c1dfe1c
---
M lib/mediawiki.WikitextSerializer.js
M tests/parserTests.txt
2 files changed, 12 insertions(+), 8 deletions(-)

Approvals:
  GWicke: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/mediawiki.WikitextSerializer.js 
b/lib/mediawiki.WikitextSerializer.js
index 8bb85ba..d42b8ea 100644
--- a/lib/mediawiki.WikitextSerializer.js
+++ b/lib/mediawiki.WikitextSerializer.js
@@ -719,9 +719,8 @@
 function getAutoURLNowikiTest(href) {
        if (/\(/.test(href)) {
                if (!autoURLNowikiTest1) {
-                       // Newlines terminate url matching -- so, look for 
non-newline chars only
-                       // in the last part of the regexp
-                       autoURLNowikiTest1 = new RegExp("^([" + src1 + src2 + 
"]|[" + src2 + "]+([^" + src2 + "\n]))");
+                       // Whitespace terminates url matching
+                       autoURLNowikiTest1 = new RegExp("^([" + src1 + src2 + 
"]|[" + src2 + "]+([^" + src2 + "\\s]))");
                }
 
                return autoURLNowikiTest1;
@@ -731,9 +730,8 @@
                        // part of the url and doesn't need nowiki escaping.
                        var src3 = src2 + ')';
 
-                       // Newlines terminate url matching -- so, look for 
non-newline chars only
-                       // in the last part of the regexp
-                       autoURLNowikiTest2 = new RegExp("^([" + src1 + src3 + 
"]|[" + src3 + "]+([^" + src3 + "\n]))");
+                       // Whitespace terminates url matching
+                       autoURLNowikiTest2 = new RegExp("^([" + src1 + src3 + 
"]|[" + src3 + "]+([^" + src3 + "\\s]))");
                }
 
                return autoURLNowikiTest2;
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index f64a67f..8848e58 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -19464,15 +19464,21 @@
 <p>x
 <a rel="mw:ExtLink" href="http://example.com"; 
data-parsoid='{"stx":"url"}'>http://example.com</a>
 y
-(<a rel="mw:ExtLink" href="http://example.com"; 
data-parsoid='{"stx":"url"}'>http://example.com</a>)
 "<a rel="mw:ExtLink" href="http://example.com"; 
data-parsoid='{"stx":"url"}'>http://example.com</a>"
+(<a rel="mw:ExtLink" href="http://example.com"; 
data-parsoid='{"stx":"url"}'>http://example.com</a>)
+(<a rel="mw:ExtLink" href="http://example.com"; 
data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
+<a rel="mw:ExtLink" href="http://example.com"; 
data-parsoid='{"stx":"url"}'>http://example.com</a>,
+<a rel="mw:ExtLink" href="http://example.com"; 
data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
 </p>
 !! wikitext
 x
 http://example.com
 y
-(http://example.com)
 "http://example.com";
+(http://example.com)
+(http://example.com) foo
+http://example.com,
+http://example.com, foo
 !! end
 
 ## Parsoid currently fails wt2html on this one!

-- 
To view, visit https://gerrit.wikimedia.org/r/133753
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7f0bd2fff3d7fc96ed1042644c097bfc6c1dfe1c
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to