C. Scott Ananian has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370833 )

Change subject: Rename bidir/unidir => twoway/oneway in LC markup.
......................................................................

Rename bidir/unidir => twoway/oneway in LC markup.

Depends-On: I7efb35245d48125b167dc0f0ef8f12aa0fff94e5
Change-Id: I44c3a63670e831cd3e69e29d0cc10bba55758082
---
M lib/html2wt/LanguageVariantHandler.js
M lib/wt2html/pegTokenizer.pegjs
M lib/wt2html/tt/LanguageVariantHandler.js
M tests/parserTests.txt
4 files changed, 93 insertions(+), 92 deletions(-)


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

diff --git a/lib/html2wt/LanguageVariantHandler.js 
b/lib/html2wt/LanguageVariantHandler.js
index 8644926..c9b652b 100644
--- a/lib/html2wt/LanguageVariantHandler.js
+++ b/lib/html2wt/LanguageVariantHandler.js
@@ -38,14 +38,14 @@
        }, new Map());
        var resultP = Promise.resolve('$E|'); // "error" flag
 
-       // Migration: `twoway` => `bidir` ; `oneway` => `unidir`
-       if (dataMWV.twoway) {
-               dataMWV.bidir = dataMWV.twoway;
-               delete dataMWV.twoway;
+       // Backwards-compatibility: `bidir` => `twoway` ; `unidir` => `oneway`
+       if (dataMWV.bidir) {
+               dataMWV.twoway = dataMWV.bidir;
+               delete dataMWV.bidir;
        }
-       if (dataMWV.oneway) {
-               dataMWV.unidir = dataMWV.oneway;
-               delete dataMWV.oneway;
+       if (dataMWV.unidir) {
+               dataMWV.oneway = dataMWV.undir;
+               delete dataMWV.unidir;
        }
 
        flags = Object.keys(dataMWV).reduce(function(f, k) {
@@ -162,14 +162,14 @@
                        }
                        return combine(sortedFlags(flags), text, false);
                });
-       } else if (Array.isArray(dataMWV.bidir)) {
-               // Bidirectional rules
+       } else if (Array.isArray(dataMWV.twoway)) {
+               // Two-way rules (most common)
                if (textSp.length % 3 === 1) {
                        trailingSemi = textSp[textSp.length - 1];
                }
-               var b = (dataMWV.bidir[0] && dataMWV.bidir[0].l === '*') ?
-                       dataMWV.bidir.slice(0, 1) :
-                       dataMWV.bidir;
+               var b = (dataMWV.twoway[0] && dataMWV.twoway[0].l === '*') ?
+                       dataMWV.twoway.slice(0, 1) :
+                       dataMWV.twoway;
                textP = Promise.all(b.map(function(rule, idx) {
                        return ser(rule.t, { protect: /;|\}-/ 
}).then(function(text) {
                                if (rule.l === '*') {
@@ -187,11 +187,12 @@
                        maybeDeleteFlag('$S');
                        return combine(sortedFlags(flags), text, trailingSemi);
                });
-       } else if (Array.isArray(dataMWV.unidir)) {
+       } else if (Array.isArray(dataMWV.oneway)) {
+               // One-way rules (uncommon)
                if (textSp.length % 4 === 1) {
                        trailingSemi = textSp[textSp.length - 1];
                }
-               textP = Promise.all(dataMWV.unidir.map(function(rule, idx) {
+               textP = Promise.all(dataMWV.oneway.map(function(rule, idx) {
                        return Promise.all([
                                ser(rule.f, { protect: /:|;|=>|\}-/ }),
                                ser(rule.t, { protect: /;|\}-/ })
diff --git a/lib/wt2html/pegTokenizer.pegjs b/lib/wt2html/pegTokenizer.pegjs
index 476598b..8dad166 100644
--- a/lib/wt2html/pegTokenizer.pegjs
+++ b/lib/wt2html/pegTokenizer.pegjs
@@ -1185,7 +1185,7 @@
     lvtext:(lang_variant_nowiki / lang_variant_text_no_semi)
     {
       return {
-        bidir: true,
+        twoway: true,
         lang: lang,
         text: lvtext,
         sp: [sp1.join(''), sp2.join(''), sp3.join('')]
@@ -1200,7 +1200,7 @@
     to:(lang_variant_nowiki / lang_variant_text_no_semi)
     {
       return {
-        unidir: true,
+        oneway: true,
         from: from,
         lang: lang,
         to: to,
diff --git a/lib/wt2html/tt/LanguageVariantHandler.js 
b/lib/wt2html/tt/LanguageVariantHandler.js
index 1d5c040..cb9c7fe 100644
--- a/lib/wt2html/tt/LanguageVariantHandler.js
+++ b/lib/wt2html/tt/LanguageVariantHandler.js
@@ -103,10 +103,10 @@
        // convert all variant texts to DOM
        var isBlock = false;
        return Promise.map(dataAttribs.texts, function(t) {
-               if (t.bidir) {
+               if (t.twoway) {
                        return convertOne(t.text).then(function(text) {
                                isBlock = isBlock || text.isBlock;
-                               return { lang: t.lang, text: text.xmlstr, 
bidir: true, sp: t.sp };
+                               return { lang: t.lang, text: text.xmlstr, 
twoway: true, sp: t.sp };
                        });
                } else if (t.lang) {
                        return Promise.all([convertOne(t.from), 
convertOne(t.to)]).
@@ -121,23 +121,23 @@
                        });
                }
        }).then(function(texts) {
-               // collect bidirectional/unidirectional translations
-               var unidir = [];
-               var bidir = [];
-               var sawBidir = false;
-               var sawUnidir = false;
+               // collect two-way/one-way conversion rules
+               var oneway = [];
+               var twoway = [];
+               var sawTwoway = false;
+               var sawOneway = false;
                var textSp;
-               var bidirSp = [];
-               var unidirSp = [];
+               var twowaySp = [];
+               var onewaySp = [];
                texts.forEach(function(t) {
-                       if (t.bidir) {
-                               bidir.push({ l: t.lang, t: t.text });
-                               bidirSp.push(t.sp[0], t.sp[1], t.sp[2]);
-                               sawBidir = true;
+                       if (t.twoway) {
+                               twoway.push({ l: t.lang, t: t.text });
+                               twowaySp.push(t.sp[0], t.sp[1], t.sp[2]);
+                               sawTwoway = true;
                        } else if (t.lang) {
-                               unidir.push({ l: t.lang, f: t.from, t: t.to });
-                               unidirSp.push(t.sp[0], t.sp[1], t.sp[2], 
t.sp[3]);
-                               sawUnidir = true;
+                               oneway.push({ l: t.lang, f: t.from, t: t.to });
+                               onewaySp.push(t.sp[0], t.sp[1], t.sp[2], 
t.sp[3]);
+                               sawOneway = true;
                        }
                });
 
@@ -170,10 +170,10 @@
                        if (texts.length === 1 && !texts[0].lang  && 
!dataMWV.name) {
                                if (dataMWV.add || dataMWV.remove) {
                                        var variants = [ '*' ];
-                                       bidir = variants.map(function(code) {
+                                       twoway = variants.map(function(code) {
                                                return { l: code, t: 
texts[0].text };
                                        });
-                                       sawBidir = true;
+                                       sawTwoway = true;
                                } else {
                                        dataMWV.disabled = true;
                                        dataMWV.describe = undefined;
@@ -190,14 +190,14 @@
                                }
                                dataMWV.show =
                                        (dataMWV.title || dataMWV.add) ? 
undefined : true;
-                       } else if (sawBidir) {
-                               dataMWV.bidir = bidir;
-                               textSp = bidirSp;
-                               if (sawUnidir) { dataMWV.error = true; }
+                       } else if (sawTwoway) {
+                               dataMWV.twoway = twoway;
+                               textSp = twowaySp;
+                               if (sawOneway) { dataMWV.error = true; }
                        } else {
-                               dataMWV.unidir = unidir;
-                               textSp = unidirSp;
-                               if (!sawUnidir) { dataMWV.error = true; }
+                               dataMWV.oneway = oneway;
+                               textSp = onewaySp;
+                               if (!sawOneway) { dataMWV.error = true; }
                        }
                }
                // Use meta/not meta instead of explicit 'show' flag.
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index f6445bd..ca8d7b1 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -18250,7 +18250,7 @@
 </p>
 !! html/parsoid
 <p>this bit is safe: }-</p>
-<p>but if we add a conversion instance: <span typeof="mw:LanguageVariant" 
data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"bidir":[{"l":"zh-cn","t":"xxx"},{"l":"zh-tw","t":"yyy"}]}'></span></p>
+<p>but if we add a conversion instance: <span typeof="mw:LanguageVariant" 
data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"twoway":[{"l":"zh-cn","t":"xxx"},{"l":"zh-tw","t":"yyy"}]}'></span></p>
 <p>then we get cut off here: }-</p>
 <p>all additional text is vanished</p>
 !! end
@@ -21525,7 +21525,7 @@
 <p>Taiwan, not China
 </p>
 !! html/parsoid
-<p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>,
 not China</p>
+<p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>,
 not China</p>
 !! end
 
 !! test
@@ -21555,12 +21555,12 @@
 <span title="ЛаCтин">ски</span>
 </p>
 !! html/parsoid
-<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' 
data-mw-variant='{"add":true,"unidir":[{"f":"span","l":"sr-ec","t":"script"},{"f":"title","l":"sr-ec","t":"src"}]}'/>
-<span title="Latin" typeof="mw:ExpandedAttrs" 
data-mw='{"attribs":[[{"txt":"title"},{"html":"La&lt;span 
typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"bidir\":[{\"l\":\"sr-el\",\"t\":\"L\"},{\"l\":\"sr-ec\",\"t\":\"C\"}]}&#39;
 
data-parsoid=&#39;{\"fl\":[],\"tSp\":[6],\"dsr\":[57,76,null,2]}&#39;>&lt;/span>tin"}]]}'>ski</span></p>
+<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' 
data-mw-variant='{"add":true,"oneway":[{"f":"span","l":"sr-ec","t":"script"},{"f":"title","l":"sr-ec","t":"src"}]}'/>
+<span title="Latin" typeof="mw:ExpandedAttrs" 
data-mw='{"attribs":[[{"txt":"title"},{"html":"La&lt;span 
typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"twoway\":[{\"l\":\"sr-el\",\"t\":\"L\"},{\"l\":\"sr-ec\",\"t\":\"C\"}]}&#39;
 
data-parsoid=&#39;{\"fl\":[],\"tSp\":[6],\"dsr\":[57,76,null,2]}&#39;>&lt;/span>tin"}]]}'>ski</span></p>
 !! end
 
 !! test
-Explicit session-wise bidirectional language variant mapping (A flag and - 
flag)
+Explicit session-wise two-way language variant mapping (A flag and - flag)
 !! options
 language=zh variant=zh-tw
 !! wikitext
@@ -21581,15 +21581,15 @@
 </p><p>and China is China.
 </p>
 !! html/parsoid
-<p>This is <span typeof="mw:LanguageVariant" 
data-mw-variant='{"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>,
 but we'll forget that now.</p>
+<p>This is <span typeof="mw:LanguageVariant" 
data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>,
 but we'll forget that now.</p>
 <p>Taiwan is not China.</p>
-<p>But <span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>
 is China,</p>
-<p>(This<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}],"remove":true}'/>
 should be stripped!)</p>
+<p>But <span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>
 is China,</p>
+<p>(This<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"remove":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
 should be stripped!)</p>
 <p>and <span typeof="mw:LanguageVariant" 
data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
 !! end
 
 !! test
-Explicit session-wise unidirectional language variant mapping (A flag and - 
flag)
+Explicit session-wise one-way language variant mapping (A flag and - flag)
 !! options
 language=zh variant=zh-tw
 !! wikitext
@@ -21610,15 +21610,15 @@
 </p><p>and COUNTRY is COUNTRY.
 </p>
 !! html/parsoid
-<p>This is <span typeof="mw:LanguageVariant" 
data-mw-variant='{"unidir":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span>,
 but we'll forget that now.</p>
+<p>This is <span typeof="mw:LanguageVariant" 
data-mw-variant='{"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span>,
 but we'll forget that now.</p>
 <p>COUNTRY is China or Taiwan.</p>
-<p>But <span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"unidir":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span>
 is COUNTRY,</p>
-<p>(This<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"remove":true,"unidir":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'/>
 should be stripped!)</p>
+<p>But <span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span>
 is COUNTRY,</p>
+<p>(This<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}],"remove":true}'/>
 should be stripped!)</p>
 <p>and <span typeof="mw:LanguageVariant" 
data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
 !! end
 
 !! test
-Explicit session-wise bidirectional language variant mapping (H flag for hide)
+Explicit session-wise two-way language variant mapping (H flag for hide)
 !! options
 language=zh variant=zh-tw
 !! wikitext
@@ -21630,12 +21630,12 @@
 </p><p>Taiwan is Taiwan.
 </p>
 !! html/parsoid
-<p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"add":true,"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
 should be stripped!)</p>
+<p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
 should be stripped!)</p>
 <p>Taiwan is China.</p>
 !! end
 
 !! test
-Explicit session-wise unidirectional language variant mapping (H flag for hide)
+Explicit session-wise one-way language variant mapping (H flag for hide)
 !! options
 language=zh variant=zh-tw
 !! wikitext
@@ -21647,7 +21647,7 @@
 </p><p>Taiwan is Taiwan or China.
 </p>
 !! html/parsoid
-<p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' 
data-mw-variant='{"add":true,"unidir":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'/>
 should be stripped!)</p>
+<p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' 
data-mw-variant='{"add":true,"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'/>
 should be stripped!)</p>
 <p>COUNTRY is Taiwan or China.</p>
 !! end
 
@@ -21666,7 +21666,7 @@
 </p><p>Taiwan is China.
 </p>
 !! html/parsoid
-<p>Should be stripped<meta typeof="mw:LanguageVariant" 
data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}],"title":true}'/>!</p>
+<p>Should be stripped<meta typeof="mw:LanguageVariant" 
data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
 <p>Taiwan is China.</p>
 !! end
 
@@ -21684,7 +21684,7 @@
 </p><p>Taiwan is Taiwan.
 </p>
 !! html/parsoid
-<p>Should be stripped<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}],"title":true}'/>!</p>
+<p>Should be stripped<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
 <p>Taiwan is China.</p>
 !! end
 
@@ -21701,7 +21701,7 @@
 Taiwan is Taiwan.
 </p>
 !! html/parsoid
-<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
+<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
 Taiwan is China.<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
 !! end
 
@@ -21721,9 +21721,9 @@
 Taiwan is China.
 </p>
 !! html/parsoid
-<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
+<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
 Taiwan is China.
-<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"*","t":"China"}]}'/>
+<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
 Taiwan is China.</p>
 !! end
 
@@ -21755,13 +21755,13 @@
 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
 </p>
 !! html/parsoid
-<p><span typeof="mw:LanguageVariant" 
data-mw-variant='{"bidir":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}],"describe":true}'></span>
-<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}],"describe":true}'/>
-<span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}],"describe":true}'></span></p>
-<p><span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"describe":true,"unidir":[{"f":"FOO","l":"zh-tw","t":"BAR"},{"f":"FOO","l":"zh-cn","t":"BAT"}]}'></span></p>
-<p><span typeof="mw:LanguageVariant" 
data-mw-variant='{"describe":true,"unidir":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
-<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"describe":true,"unidir":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
-<span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"describe":true,"unidir":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
+<p><span typeof="mw:LanguageVariant" 
data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
+<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
+<span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
+<p><span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"FOO","l":"zh-tw","t":"BAR"},{"f":"FOO","l":"zh-cn","t":"BAT"}]}'></span></p>
+<p><span typeof="mw:LanguageVariant" 
data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
+<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
+<span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
 !! end
 
@@ -21812,7 +21812,7 @@
 <p>Should be stripped!
 </p>
 !! html/parsoid
-<p>Should be stripped<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}],"title":true}'/>!</p>
+<p>Should be stripped<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
 !! end
 
 !! test
@@ -21829,8 +21829,8 @@
 Should be stripped<span title="Exclamation">!</span>
 </p>
 !! html/parsoid
-<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
-Should be stripped<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"bidir":[{"l":"zh-cn","t":"China"},{"l":"zh-tw","t":"Taiwan"}],"title":true}'/><span
 title="exclamation">!</span></p>
+<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
+Should be stripped<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"title":true,"twoway":[{"l":"zh-cn","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/><span
 title="exclamation">!</span></p>
 !! end
 
 !! test
@@ -21847,8 +21847,8 @@
 </p><p>This won't take interferes with the title rule.
 </p>
 !! html/parsoid
-<p>This should be stripped<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"bidir":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}],"title":true}'/>!</p>
-<p>This won't take interferes with the title rule<meta 
typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"zh","t":"Beijing"},{"l":"zh-tw","t":"Taipei"}]}'/>.</p>
+<p>This should be stripped<meta typeof="mw:LanguageVariant" 
data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
+<p>This won't take interferes with the title rule<meta 
typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"Beijing"},{"l":"zh-tw","t":"Taipei"}]}'/>.</p>
 !! end
 
 !! test
@@ -21862,7 +21862,7 @@
 <p>
 </p>
 !! html/parsoid
-<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"bidir":[{"l":"zh-cn","t":"CN"},{"l":"zh-tw","t":"TW"}],"title":true}'/></p>
+<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"title":true,"twoway":[{"l":"zh-cn","t":"CN"},{"l":"zh-tw","t":"TW"}]}'/></p>
 !! end
 
 !! test
@@ -21917,7 +21917,7 @@
 <p>Nested raw: nested Taiwan nested
 </p>
 !! html/parsoid
-<p>Nested raw: <span typeof="mw:LanguageVariant" 
data-mw-variant='{"disabled":{"t":"nested &lt;span 
typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"bidir\":[{\"l\":\"zh\",\"t\":\"China\"},{\"l\":\"zh-tw\",\"t\":\"Taiwan\"}]}&#39;
 
data-parsoid=&#39;{\"fl\":[],\"tSp\":[6],\"dsr\":[23,48,null,2]}&#39;>&lt;/span>
 nested"}}'></span></p>
+<p>Nested raw: <span typeof="mw:LanguageVariant" 
data-mw-variant='{"disabled":{"t":"nested &lt;span 
typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"twoway\":[{\"l\":\"zh\",\"t\":\"China\"},{\"l\":\"zh-tw\",\"t\":\"Taiwan\"}]}&#39;
 
data-parsoid=&#39;{\"fl\":[],\"tSp\":[6],\"dsr\":[23,48,null,2]}&#39;>&lt;/span>
 nested"}}'></span></p>
 !! end
 
 !! test
@@ -21956,7 +21956,7 @@
 <p>0
 </p>
 !! html/parsoid
-<p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[12]}' 
data-mw-variant='{"bidir":[{"l":"zh-cn","t":"0"},{"l":"zh-sg","t":"1"},{"l":"zh-tw","t":"2"},{"l":"zh-hk","t":"3"}]}'></span></p>
+<p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[12]}' 
data-mw-variant='{"twoway":[{"l":"zh-cn","t":"0"},{"l":"zh-sg","t":"1"},{"l":"zh-tw","t":"2"},{"l":"zh-hk","t":"3"}]}'></span></p>
 !! end
 
 !! test
@@ -21969,11 +21969,11 @@
 <p>D12345EE12345
 </p>
 !! html/parsoid
-<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"unidir":[{"f":"0","l":"zh-cn","t":"B"}]}'/><meta 
typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"unidir":[{"f":"0","l":"zh-cn","t":"C"},{"f":"0","l":"zh-cn","t":"D"}]}'/><meta
 typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"unidir":[{"f":"0","l":"zh-hans","t":"A"}]}'/>012345<span
 typeof="mw:LanguageVariant" data-parsoid='{"fl":["A"],"tSp":[7]}' 
data-mw-variant='{"add":true,"bidir":[{"l":"zh-tw","t":"0"},{"l":"zh-cn","t":"E"}]}'></span>012345</p>
+<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"B"}]}'/><meta 
typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"C"},{"f":"0","l":"zh-cn","t":"D"}]}'/><meta
 typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-hans","t":"A"}]}'/>012345<span
 typeof="mw:LanguageVariant" data-parsoid='{"fl":["A"],"tSp":[7]}' 
data-mw-variant='{"add":true,"twoway":[{"l":"zh-tw","t":"0"},{"l":"zh-cn","t":"E"}]}'></span>012345</p>
 !! end
 
 !! test
-Bidirectional converter rule entries with an empty value should be ignored 
(T53551)
+Two-way converter rule entries with an empty value should be ignored (T53551)
 !! options
 language=zh variant=zh-cn
 !! input
@@ -21982,11 +21982,11 @@
 <p>foobar
 </p>
 !! html/parsoid
-<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' 
data-mw-variant='{"add":true,"bidir":[{"l":"zh-cn","t":"foo"},{"l":"zh-tw","t":""}]}'/>foobar</p>
+<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' 
data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"foo"},{"l":"zh-tw","t":""}]}'/>foobar</p>
 !! end
 
 !! test
-Unidirectional converter rule entries with an empty "from" string should be 
ignored (T53551)
+One-way converter rule entries with an empty "from" string should be ignored 
(T53551)
 !! options
 language=zh variant=zh-cn
 !! input
@@ -21995,7 +21995,7 @@
 <p>foobar
 </p>
 !! html/parsoid
-<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' 
data-mw-variant='{"add":true,"unidir":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
+<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' 
data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
 !! end
 
 !! test
@@ -22008,7 +22008,7 @@
 <p>foobar
 </p>
 !! html/parsoid
-<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"*","t":""}]}'/>foobar</p>
+<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
 !! end
 
 !! test
@@ -22021,7 +22021,7 @@
 <p>Nested: Hello Hong Kong!
 </p>
 !! html/parsoid
-<p>Nested: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' 
data-mw-variant='{"bidir":[{"l":"zh-hans","t":"Hi &lt;span 
typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"bidir\":[{\"l\":\"zh-cn\",\"t\":\"China\"},{\"l\":\"zh-sg\",\"t\":\"Singapore\"}]}&#39;
 
data-parsoid=&#39;{\"fl\":[],\"tSp\":[7],\"dsr\":[21,53,null,2]}&#39;>&lt;/span>"},{"l":"zh-hant","t":"Hello
 &lt;span typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"bidir\":[{\"l\":\"zh-tw\",\"t\":\"Taiwan\"},{\"l\":\"zh-hk\",\"t\":\"H&amp;lt;span
 typeof=\\\"mw:LanguageVariant\\\" 
data-mw-variant=&amp;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"ong\\\"}}&amp;#39; 
data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[90,97,null,2]}&amp;#39;>&amp;lt;/span>
 K&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" 
data-mw-variant=&amp;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"\\\"}}&amp;#39; 
data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[99,103,null,2]}&amp;#39;>&amp;lt;/span>ong\"}]}&#39;
 
data-parsoid=&#39;{\"fl\":[],\"tSp\":[7],\"dsr\":[68,109,null,2]}&#39;>&lt;/span>"}]}'></span>!</p>
+<p>Nested: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' 
data-mw-variant='{"twoway":[{"l":"zh-hans","t":"Hi &lt;span 
typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"twoway\":[{\"l\":\"zh-cn\",\"t\":\"China\"},{\"l\":\"zh-sg\",\"t\":\"Singapore\"}]}&#39;
 
data-parsoid=&#39;{\"fl\":[],\"tSp\":[7],\"dsr\":[21,53,null,2]}&#39;>&lt;/span>"},{"l":"zh-hant","t":"Hello
 &lt;span typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"twoway\":[{\"l\":\"zh-tw\",\"t\":\"Taiwan\"},{\"l\":\"zh-hk\",\"t\":\"H&amp;lt;span
 typeof=\\\"mw:LanguageVariant\\\" 
data-mw-variant=&amp;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"ong\\\"}}&amp;#39; 
data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[90,97,null,2]}&amp;#39;>&amp;lt;/span>
 K&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" 
data-mw-variant=&amp;#39;{\\\"disabled\\\":{\\\"t\\\":\\\"\\\"}}&amp;#39; 
data-parsoid=&amp;#39;{\\\"fl\\\":[],\\\"dsr\\\":[99,103,null,2]}&amp;#39;>&amp;lt;/span>ong\"}]}&#39;
 
data-parsoid=&#39;{\"fl\":[],\"tSp\":[7],\"dsr\":[68,109,null,2]}&#39;>&lt;/span>"}]}'></span>!</p>
 !! end
 
 !! test
@@ -22073,7 +22073,7 @@
 
 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</span></p><div 
typeof="mw:LanguageVariant" 
data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"b&lt;div 
data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[50,56,5,0]}&#39;>c&lt;/div>"}}'></div><p>d</p>
 
-<p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<meta 
typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"unidir":[{"f":"0","l":"zh-cn","t":"x&lt;span 
data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[82,89,6,0]}&#39;>y&lt;/span>"},{"f":"0","l":"zh-tw","t":"b&lt;div
 
data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[100,106,5,0]}&#39;>c&lt;/div>"}]}'/>d</span></p>
+<p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<meta 
typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"x&lt;span 
data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[82,89,6,0]}&#39;>y&lt;/span>"},{"f":"0","l":"zh-tw","t":"b&lt;div
 
data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[100,106,5,0]}&#39;>c&lt;/div>"}]}'/>d</span></p>
 !! end
 
 !! test
@@ -22288,7 +22288,7 @@
 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a 
href="/wiki/File:Foobar.jpg" class="image"><img alt="" 
src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg"; 
width="180" height="20" class="thumbimage" 
srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, 
http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  
<div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" 
class="internal" title="放大"></a></div>blog (hk: WEBJOURNAL, tw: 
WEBLOG)</div></div></div>
 
 !! html/parsoid
-<figure class="mw-default-size" typeof="mw:Image/Thumb" 
data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"}]}'><a 
href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" 
data-file-width="1941" data-file-height="220" data-file-type="bitmap" 
height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" 
data-mw-variant='{"bidir":[{"l":"zh-cn","t":"blog (hk: &lt;span 
typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBJOURNAL\"}}&#39;
 
data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[43,65,null,2]}&#39;>&lt;/span>,
 tw: &lt;span typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBLOG\"}}&#39; 
data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[71,89,null,2]}&#39;>&lt;/span>)"}]}'></span></figcaption></figure>
+<figure class="mw-default-size" typeof="mw:Image/Thumb" 
data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"}]}'><a 
href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" 
src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" 
data-file-width="1941" data-file-height="220" data-file-type="bitmap" 
height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" 
data-mw-variant='{"twoway":[{"l":"zh-cn","t":"blog (hk: &lt;span 
typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBJOURNAL\"}}&#39;
 
data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[43,65,null,2]}&#39;>&lt;/span>,
 tw: &lt;span typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBLOG\"}}&#39; 
data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[71,89,null,2]}&#39;>&lt;/span>)"}]}'></span></figcaption></figure>
 !! end
 
 # XXX html2wt disabled because rich markup in alt is not preserved.
@@ -22344,7 +22344,7 @@
 <dt>foo:bar</dt></dl>
 
 !! html/parsoid
-<dl><dt data-parsoid='{"dsr":[0,24,1,0]}'><span typeof="mw:LanguageVariant" 
data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"bidir":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}]}'></span></dt>
+<dl><dt data-parsoid='{"dsr":[0,24,1,0]}'><span typeof="mw:LanguageVariant" 
data-parsoid='{"tSp":[6]}' 
data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}]}'></span></dt>
 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" 
data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
 </dl>
 !! end
@@ -22381,7 +22381,7 @@
 <dd>def</dd></dl>
 
 !! html/parsoid
-<dl><dt data-parsoid='{"dsr":[0,49,1,0]}'><span typeof="mw:LanguageVariant" 
data-mw-variant='{"bidir":[{"l":"zh-cn","t":"AAA &lt;span 
typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"foo:bar\"}}&#39; 
data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[14,33,null,2]}&#39;>&lt;/span> 
&lt;span typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"disabled\":{\"t\":\"bat:baz\"}}&#39; 
data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[34,47,null,2]}&#39;>&lt;/span>"}]}'></span></dt>
+<dl><dt data-parsoid='{"dsr":[0,49,1,0]}'><span typeof="mw:LanguageVariant" 
data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA &lt;span 
typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"foo:bar\"}}&#39; 
data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[14,33,null,2]}&#39;>&lt;/span> 
&lt;span typeof=\"mw:LanguageVariant\" 
data-mw-variant=&#39;{\"disabled\":{\"t\":\"bat:baz\"}}&#39; 
data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[34,47,null,2]}&#39;>&lt;/span>"}]}'></span></dt>
 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
 </dl>
 !! end
@@ -22490,10 +22490,10 @@
 !! options
 language=zh variant=zh-cn
 !! html/parsoid
-<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"unidir":[{"f":"a:b=>c","l":"zh-cn","t":"x;foo=>zh-cn:boo"},{"f":"bar","l":"zh-cn","t":"bat;xyz=>zh-cn:abc"}]}'/>foobar</p>
-<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"unidir":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
-<p><span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"bidir":[{"l":"zh-tw","t":"xyz"},{"l":"zh-cn","t":"0;zh-tw:bar"}]}'></span></p>
-<p><span typeof="mw:LanguageVariant" 
data-mw-variant='{"bidir":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
+<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"oneway":[{"f":"a:b=>c","l":"zh-cn","t":"x;foo=>zh-cn:boo"},{"f":"bar","l":"zh-cn","t":"bat;xyz=>zh-cn:abc"}]}'/>foobar</p>
+<p><meta typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
+<p><span typeof="mw:LanguageVariant" 
data-mw-variant='{"add":true,"twoway":[{"l":"zh-tw","t":"xyz"},{"l":"zh-cn","t":"0;zh-tw:bar"}]}'></span></p>
+<p><span typeof="mw:LanguageVariant" 
data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
 <p>a:b=>c xyz</p>
 !! wikitext
 
-{H|<nowiki>a:b=>c</nowiki>=>zh-cn:<nowiki>x;foo=>zh-cn:boo</nowiki>;bar=>zh-cn:<nowiki>bat;xyz=>zh-cn:abc</nowiki>}-foobar

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I44c3a63670e831cd3e69e29d0cc10bba55758082
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org>

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

Reply via email to