Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/129561

Change subject: WIP: look at underscores
......................................................................

WIP: look at underscores

Change-Id: I9eed0ffc911b45fcc35a7d71a2a2f93e575cd10a
---
M lib/wts.LinkHandler.js
M tests/parserTests-blacklist.js
2 files changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/61/129561/1

diff --git a/lib/wts.LinkHandler.js b/lib/wts.LinkHandler.js
index b1c0a8e..e838dc3 100644
--- a/lib/wts.LinkHandler.js
+++ b/lib/wts.LinkHandler.js
@@ -416,7 +416,7 @@
                                }
                                linkTarget = target.value;
                                if (target.modified || !target.fromsrc) {
-                                       linkTarget = 
linkTarget.replace(/^(\.\.?\/)*/, '').replace(/_/g, ' ');
+                                       linkTarget = 
linkTarget.replace(/^(\.\.?\/)*/, '');
                                        escapedRes = 
escapeWikiLinkContentString(linkTarget,
                                                state, linkData.contentNode);
                                        linkTarget = escapedRes.linkTarget;
diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js
index 31a7557..2783a3b 100644
--- a/tests/parserTests-blacklist.js
+++ b/tests/parserTests-blacklist.js
@@ -697,7 +697,6 @@
 add("html2html", "Inline interwiki link with empty title (bug 2372)", "<p 
data-parsoid='{\"dsr\":[0,91,0,0]}'>&lt;a 
href=\"http://www.usemod.com/cgi-bin/mb.pl\"; class=\"extiw\" 
title=\"meatball:\">MeatBall:&lt;/a></p>\n");
 add("html2html", "Interwiki link encoding conversion (bug 1636)", "<ul 
data-parsoid='{\"dsr\":[0,255,0,0]}'><li data-parsoid='{\"dsr\":[0,127,1,0]}'> 
&lt;a href=\"http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a\"; class=\"extiw\" 
title=\"wikipedia:ro:Olteniţa\">Wikipedia:ro:Olteniţa&lt;/a></li>\n<li 
data-parsoid='{\"dsr\":[128,255,1,0]}'> &lt;a 
href=\"http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a\"; class=\"extiw\" 
title=\"wikipedia:ro:Olteniţa\">Wikipedia:ro:Olteniţa&lt;/a></li></ul>\n");
 add("html2html", "Interwiki link with fragment (bug 2130)", "<p 
data-parsoid='{\"dsr\":[0,136,0,0]}'>&lt;a 
href=\"http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo\"; class=\"extiw\" 
title=\"meatball:SoftSecurity\">MeatBall:SoftSecurity#foo&lt;/a></p>\n");
-add("html2html", "Interwiki links that cannot be represented in wiki syntax", 
"<p data-parsoid='{\"dsr\":[0,212,0,0]}'><a rel=\"mw:ExtLink\" 
href=\"http://www.usemod.com/cgi-bin/mb.pl?ok\"; 
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?ok\"},\"sa\":{\"href\":\"meatball:ok\"},\"isIW\":true,\"dsr\":[0,15,2,2]}'>meatball:ok</a>\n<a
 rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?ok#foo\"; 
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?ok#foo\"},\"sa\":{\"href\":\"meatball:ok#foo\"},\"isIW\":true,\"dsr\":[16,52,18,2]}'>ok
 with fragment</a>\n<a rel=\"mw:ExtLink\" 
href=\"http://www.usemod.com/cgi-bin/mb.pl?ok as well?\" 
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?ok
 as well?\"},\"sa\":{\"href\":\"meatball:ok as 
well?\"},\"isIW\":true,\"dsr\":[53,99,23,2]}'>ok ending with ? mark</a>\n<a 
rel=\"mw:ExtLink\" href=\"http://de.wikipedia.org/wiki/Foo?action=history\"; 
data-parsoid='{\"targetOff\":149,\"contentOffsets\":[149,158],\"dsr\":[100,159,49,1]}'>has
 query</a>\n<a rel=\"mw:ExtLink\" href=\"http://de.wikipedia.org/wiki/#foo\"; 
data-parsoid='{\"targetOff\":195,\"contentOffsets\":[195,211],\"dsr\":[160,212,35,1]}'>is
 just fragment</a></p>\n");
 add("html2html", "Parsoid-specific test: Wikilinks with &nbsp; should RT 
properly", "<p data-parsoid='{\"dsr\":[0,111,0,0]}'>&lt;a 
href=\"/index.php?title=WW_II&amp;action=edit&amp;redlink=1\" class=\"new\" 
title=\"WW II (lonkásá  ezalí tɛ̂)\">WW II&lt;/a></p>\n");
 add("html2html", "Parsoid: recognize interlanguage links without a target 
page", "\n<p data-parsoid='{\"dsr\":[1,34,0,0]}'>[<a rel=\"mw:ExtLink\" 
href=\"http://ko.wikipedia.org/wiki/\"; 
data-parsoid='{\"targetOff\":32,\"contentOffsets\":[32,32],\"dsr\":[2,33,30,1]}'></a>]</p>\n");
 add("html2html", "Parsoid: recognize interwiki links without a target page", 
"<p data-parsoid='{\"dsr\":[0,7,0,0]}'><link rel=\"mw:PageProp/Language\" 
href=\"//ko.wikipedia.org/wiki/\" 
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"//ko.wikipedia.org/wiki/\"},\"sa\":{\"href\":\"ko:\"},\"dsr\":[0,7,null,null]}'/></p>\n");
@@ -848,7 +847,7 @@
 add("html2html", ":Image link to nonexistent file (bug 1850 - bad)", "<p 
data-parsoid='{\"dsr\":[0,146,0,0]}'>&lt;a 
href=\"/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1\" 
class=\"new\" title=\"File:No such.jpg (page does not exist)\">Image:No 
such.jpg&lt;/a></p>\n");
 add("html2html", "Character reference normalization in link text (bug 1938)", 
"<p data-parsoid='{\"dsr\":[0,57,0,0]}'>&lt;a href=\"/wiki/Main_Page\" 
title=\"Main Page\">this&amp;that&lt;/a></p>\n");
 add("html2html", "(bug 19451) Links should refer to the normalized form.", "<p 
data-parsoid='{\"dsr\":[0,233,0,0]}'>&lt;a href=\"/wiki/%D7%90%D6%B7\" 
title=\"אַ\">אַ&lt;/a>\n&lt;a href=\"/wiki/%D7%90%D6%B7\" 
title=\"אַ\">אַ&lt;/a>\n&lt;a href=\"/wiki/%D7%90%D6%B7\" 
title=\"אַ\">אַ&lt;/a>\n&lt;a href=\"/wiki/%D7%90%D6%B7\" 
title=\"אַ\">אַ&lt;/a>\n&lt;a href=\"/wiki/%D7%90%D6%B7\" 
title=\"אַ\">אַ&lt;/a></p>\n");
-add("html2html", "Bug 2095: link with pipe and three closing brackets, version 
2", "<p data-parsoid='{\"dsr\":[0,52,0,0]}'><a rel=\"mw:WikiLink\" 
href=\"./Main_Page\" 
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main
 Page\"},\"dsr\":[0,52,12,2]}'><span typeof=\"mw:Nowiki\" 
data-parsoid='{\"dsr\":[12,50,8,9]}'>[http://example.com/]</span></a></p>\n");
+add("html2html", "Bug 2095: link with pipe and three closing brackets, version 
2", "<p data-parsoid='{\"dsr\":[0,52,0,0]}'><a rel=\"mw:WikiLink\" 
href=\"./Main_Page\" 
data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main_Page\"},\"dsr\":[0,52,12,2]}'><span
 typeof=\"mw:Nowiki\" 
data-parsoid='{\"dsr\":[12,50,8,9]}'>[http://example.com/]</span></a></p>\n");
 add("html2html", "Bug 2304: HTML attribute safety (dangerous style template; 
2309)", "<div style=\" \" data-parsoid='{\"stx\":\"html\",\"a\":{\"style\":\" 
\"},\"sa\":{\"style\":\"/* insecure input 
*/\"},\"dsr\":[0,40,34,6]}'></div>\n");
 add("html2html", "Bug 2304: HTML attribute safety (unsafe parameter; 2309)", 
"<div style=\" \" data-parsoid='{\"stx\":\"html\",\"a\":{\"style\":\" 
\"},\"sa\":{\"style\":\"/* insecure input */\"},\"dsr\":[0,49,34,6]}'>Magic 
div</div>\n");
 add("html2html", "Bug 3244: HTML attribute safety (extension; unsafe)", "<div 
style=\" \" data-parsoid='{\"stx\":\"html\",\"a\":{\"style\":\" 
\"},\"sa\":{\"style\":\"/* insecure input 
*/\"},\"dsr\":[0,40,34,6]}'></div>\n");
@@ -1217,7 +1216,7 @@
 add("html2wt", "Bracketed external links with template-generated invalid 
target", "[http:/example.com title]\n");
 add("html2wt", "Bug 2702: Mismatched <i>, <b> and <a> tags are invalid", 
"[http://example.com ''text'']\n[http://example.com '''text''']\n''Something 
''[http://example.com ''in italic'']\n''Something ''[http://example.com 
''mixed''''', even bold''']\n'''''Now '''''[http://example.com 
'''''both''''']\n");
 add("html2wt", "External link containing double-single-quotes in text embedded 
in italics (bug 4598 sanity check)", "''Some ''[http://example.com/ ''pretty 
''italics'' and stuff'']''!''\n");
-add("html2wt", "External link containing double-single-quotes with no space 
separating the url from text in italics", 
"[http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm ''La muerte de 
Casagemas'' (1901) en el sitio de ][[Museo Picasso (París)|Museo 
Picasso]]<span>.</span>\n");
+add("html2wt", "External link containing double-single-quotes with no space 
separating the url from text in italics", 
"[http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm ''La muerte de 
Casagemas'' (1901) en el sitio de ][[Museo_Picasso_(París)|Museo 
Picasso]]<span>.</span>\n");
 add("html2wt", "External link with comments in link text", 
"[http://www.google.com Google ]\n");
 add("html2wt", "URL-encoding in URL functions (single parameter)", 
"/index.php?title=Some_page&amp=&\n");
 add("html2wt", "URL-encoding in URL functions (multiple parameters)", 
"/index.php?title=Some_page&q=?&amp=&\n");
@@ -1272,6 +1271,7 @@
 add("html2wt", "Link with double quotes in title part (literal) and alternate 
part (interpreted)", "<meta 
/>\n[[''Pentecoste'']]\n\n[[''Pentecoste''|Pentecoste]]\n\n[[''Pentecoste''|''Pentecoste'']]\n");
 add("html2wt", "Broken image links with HTML captions (bug 39700)", "<a 
href=\"/index.php?title=Special:Upload&wpDestFile=Nonexistent\" class=\"new\" 
title=\"File:Nonexistent\"><script></script></a>\n<a 
href=\"/index.php?title=Special:Upload&wpDestFile=Nonexistent\" class=\"new\" 
title=\"File:Nonexistent\"><script></script></a>\n<a 
href=\"/index.php?title=Special:Upload&wpDestFile=Nonexistent\" class=\"new\" 
title=\"File:Nonexistent\"><</a>\n<a 
href=\"/index.php?title=Special:Upload&wpDestFile=Nonexistent\" class=\"new\" 
title=\"File:Nonexistent\">abc</a>\n");
 add("html2wt", "Plain link to page with question mark in title", "<a 
href=\"/wiki/A%3Fb\" title=\"A?b\">A?b</a>\n\n<a href=\"/wiki/A%3Fb\" 
title=\"A?b\">Baz</a>\n");
+add("html2wt", "BUG 2: [[page|http://url/]] should link to page, not 
http://url/";, "[[Main_Page|http://url/]]\n";);
 add("html2wt", "BUG 337: Escaped self-links should be bold", "[[Bug462]] 
[[Bug462]]\n");
 add("html2wt", "Self-link to section should not be bold", "<a 
href=\"/wiki/Main_Page#section\" title=\"Main Page\">Main Page#section</a>\n");
 add("html2wt", "Self-link to numeric title", "<strong 
class=\"selflink\">0</strong>\n");
@@ -1290,7 +1290,6 @@
 add("html2wt", "Inline interwiki link with empty title (bug 2372)", "<a 
href=\"http://www.usemod.com/cgi-bin/mb.pl\"; class=\"extiw\" 
title=\"meatball:\">MeatBall:</a>\n");
 add("html2wt", "Interwiki link encoding conversion (bug 1636)", "* <a 
href=\"http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a\"; class=\"extiw\" 
title=\"wikipedia:ro:Olteniţa\">Wikipedia:ro:Olteniţa</a>\n* <a 
href=\"http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a\"; class=\"extiw\" 
title=\"wikipedia:ro:Olteniţa\">Wikipedia:ro:Olteniţa</a>\n");
 add("html2wt", "Interwiki link with fragment (bug 2130)", "<a 
href=\"http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo\"; class=\"extiw\" 
title=\"meatball:SoftSecurity\">MeatBall:SoftSecurity#foo</a>\n");
-add("html2wt", "Interwiki links that cannot be represented in wiki syntax", 
"[[meatball:ok]]\n[[meatball:ok#foo|ok with fragment]]\n[[meatball:ok as 
well?|ok ending with ? mark]]\n[http://de.wikipedia.org/wiki/Foo?action=history 
has query]\n[http://de.wikipedia.org/wiki/#foo is just fragment]\n");
 add("html2wt", "Interlanguage link", "Blah blah blah\n");
 add("html2wt", "Double interlanguage link", "Blah blah blah\n");
 add("html2wt", "Interlanguage link, with prefix links", "Blah blah blah\n");
@@ -1625,7 +1624,8 @@
 add("html2wt", "Attribute test: unquoted value", "<font 
color=\"x\">foo</font>\n");
 add("html2wt", "Attribute test: unquoted but illegal value (hash)", "<font 
color=\"#x\">foo</font>\n");
 add("html2wt", "Attribute test: no value", "<font 
color=\"color\">foo</font>\n");
-add("html2wt", "Bug 2095: link with pipe and three closing brackets, version 
2", "[[Main Page|<nowiki>[http://example.com/]</nowiki>]]\n");
+add("html2wt", "Bug 2095: link with pipe and three closing brackets", 
"[[Main_Page|link]]]\n");
+add("html2wt", "Bug 2095: link with pipe and three closing brackets, version 
2", "[[Main_Page|<nowiki>[http://example.com/]</nowiki>]]\n");
 add("html2wt", "Bug 2304: HTML attribute safety (safe template; regression bug 
2309)", "<div title=\"This is a test template\"></div>\n");
 add("html2wt", "Bug 2304: HTML attribute safety (dangerous template; 2309)", 
"<div title=\"\"></div>\n");
 add("html2wt", "Bug 2304: HTML attribute safety (dangerous style template; 
2309)", "<div style=\"/* insecure input */\"></div>\n");

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9eed0ffc911b45fcc35a7d71a2a2f93e575cd10a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>

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

Reply via email to