Subramanya Sastry has uploaded a new change for review.

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


Change subject: Fixes to wikitext escaping in <th> tags
......................................................................

Fixes to wikitext escaping in <th> tags

* "foo||bar" in the HTML below should be nowiki-escaped
  during serialization.  This patch fixes this.
-------------
<table>
<tr><th>foo||bar
</th></tr></table>
-------------

* 1 html2html test now passes, but 1 html2wt test now fails
  The html2wt failure is due to stale parser tests.  Once the
  parserTests.txt patch submitted for review is merged, some of
  these tests will get fixed.

Change-Id: I04863d63d8cbd36460fa6157944198ee680a97d5
---
M js/lib/mediawiki.WikitextSerializer.js
M js/tests/parserTests-blacklist.js
M js/tests/wt_escape.tests.txt
3 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/js/lib/mediawiki.WikitextSerializer.js 
b/js/lib/mediawiki.WikitextSerializer.js
index bab9f11..ed92b04 100644
--- a/js/lib/mediawiki.WikitextSerializer.js
+++ b/js/lib/mediawiki.WikitextSerializer.js
@@ -168,7 +168,7 @@
 };
 
 WEHP.thHandler = function(state, text) {
-       return text.match(/!!/);
+       return text.match(/!!|\|\|/);
 };
 
 WEHP.wikilinkHandler = function(state, text) {
diff --git a/js/tests/parserTests-blacklist.js 
b/js/tests/parserTests-blacklist.js
index 1706cf1..335ad97 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -1066,7 +1066,6 @@
 add("html2html", "Gallery with invalid title as link (bug 43964)");
 add("html2html", "Headings: 2. Outside heading nest on a single line 
<h1>foo</h1>*bar");
 add("html2html", "HRs: 1. Single line");
-add("html2html", "Tables: 3c. Nested in th -- no escaping needed");
 add("html2html", "Links 1. Quote marks in link text");
 add("html2html", "Links 2. WikiLinks: Escapes needed");
 add("html2html", "Links 3. WikiLinks: No escapes needed");
@@ -1937,6 +1936,7 @@
 add("html2wt", "Tables: 1b. No escaping needed");
 add("html2wt", "Tables: 1c. No escaping needed");
 add("html2wt", "Tables: 1d. No escaping needed");
+add("html2wt", "Tables: 3c. Nested in th -- no escaping needed");
 add("html2wt", "Tables: 4d. No escaping needed");
 add("html2wt", "Links 2. WikiLinks: Escapes needed");
 add("html2wt", "1. No unnecessary escapes");
diff --git a/js/tests/wt_escape.tests.txt b/js/tests/wt_escape.tests.txt
index 47a7f72..2eba201 100644
--- a/js/tests/wt_escape.tests.txt
+++ b/js/tests/wt_escape.tests.txt
@@ -436,7 +436,7 @@
 Tables: 3b. Nested in th -- no escaping needed
 !! input
 {|
-!foo||bar
+!<nowiki>foo||bar</nowiki>
 |}
 !! result
 <table>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I04863d63d8cbd36460fa6157944198ee680a97d5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to