Cscott has uploaded a new change for review.

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


Change subject: Normalize superfluous %xx escaping in URLs; three more parser 
tests pass now.
......................................................................

Normalize superfluous %xx escaping in URLs; three more parser tests pass now.

This also makes the new ~ and = tests pass which were added in
https://gerrit.wikimedia.org/r/60874

Change-Id: Iddb5033c606dc40f851b4f6101037bfdb2d52ea7
---
M js/lib/mediawiki.Util.js
M js/tests/parserTests-blacklist.js
2 files changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/77/60877/1

diff --git a/js/lib/mediawiki.Util.js b/js/lib/mediawiki.Util.js
index 31e486a..a4807a1 100644
--- a/js/lib/mediawiki.Util.js
+++ b/js/lib/mediawiki.Util.js
@@ -1019,6 +1019,8 @@
                .replace(/<span[^>]+about="[^"]*"[^>]*>/g, '')
                .replace(/<span><\/span>/g, '')
                .replace(/(href=")(?:\.?\.\/)+/g, '$1')
+               // replace unnecessary URL escaping
+               .replace(/ href="[^"]*"/g, unescape)
                // strip thumbnail size prefixes
                
.replace(/(src="[^"]*?)\/thumb(\/[0-9a-f]\/[0-9a-f]{2}\/[^\/]+)\/[0-9]+px-[^"\/]+(?=")/g,
 '$1$2')
                .replace(/(<(table|tbody|tr|th|td|\/th|\/td)[^<>]*>)\s+/g, 
'$1');
@@ -1057,6 +1059,8 @@
                        .replace(/<a +href/g, '<a href')
                        .replace(/href="\/wiki\//g, 'href="')
                        .replace(/" +>/g, '">')
+                       // replace unnecessary URL escaping
+                       .replace(/ href="[^"]*"/g, unescape)
                        // strip empty spans
                        .replace(/<span><\/span>/g, '')
                        
.replace(/(<(table|tbody|tr|th|td|\/th|\/td)[^<>]*>)\s+/g, '$1');
diff --git a/js/tests/parserTests-blacklist.js 
b/js/tests/parserTests-blacklist.js
index 335ad97..251e664 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -223,7 +223,6 @@
 add("wt2html", "Subpage noslash link");
 add("wt2html", "Disabled subpages");
 add("wt2html", "BUG 561: {{/Subpage}}");
-add("wt2html", "Link to category");
 add("wt2html", "Simple category");
 add("wt2html", "PAGESINCATEGORY invalid title fatal (r33546 fix)");
 add("wt2html", "Category with different sort key");
@@ -679,7 +678,6 @@
 add("html2html", "Bug 4781, 5267: %28, %29 in bracketed URL");
 add("html2html", "External link containing double-single-quotes with no space 
separating the url from text in italics");
 add("html2html", "Brackets in urls");
-add("html2html", "IPv6 urls (bug 21261)");
 add("html2html", "Unclosed and unmatched quotes (parsoid)");
 add("html2html", "Table security: embedded pipes 
(http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)");
 add("html2html", "Indented table markup mixed with indented pre content 
(proposed in bug 6200)");
@@ -921,7 +919,6 @@
 add("html2html", "HTML ordered list item with parameters oddity");
 add("html2html", "Fuzz testing: Parser14");
 add("html2html", "Fuzz testing: Parser14-table");
-add("html2html", "Fuzz testing: Parser21");
 add("html2html", "Fuzz testing: Parser24");
 add("html2html", "Fuzz testing: URL adjacent extension (no space, dirty; 
pre)");
 add("html2html", "Fuzz testing: encoded newline in generated HTML replacements 
(bug 6577)");

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iddb5033c606dc40f851b4f6101037bfdb2d52ea7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/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