Subramanya Sastry has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/356312 )

Change subject: T136653: Handle VE-style interwiki shortcuts
......................................................................

T136653: Handle VE-style interwiki shortcuts

* VE generates "de%3AFoo" style shortcuts,
  not "./de:Foo" style shortcuts.

  Updated tests.

* Also added an explicit expectation that "de:Foo" style hrefs
  aren't recognized as an interwiki shortcut since the "de"
  should be recognized as a potential url protocol.

  Right now, Parsoid's html2wt output is buggy since we generate
  language link syntax for "de:Foo" style hrefs if we have a
  'mw:WikiLink' rel attribute.

  So, that is neither here (interwiki) nor there (url protocol).

Change-Id: Ie8d709e72a6a0621ee7b03e2d6643290bc24694c
---
M lib/config/WikiConfig.js
M tests/parserTests.txt
2 files changed, 27 insertions(+), 2 deletions(-)


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

diff --git a/lib/config/WikiConfig.js b/lib/config/WikiConfig.js
index a86f8b9..9f9c79c 100644
--- a/lib/config/WikiConfig.js
+++ b/lib/config/WikiConfig.js
@@ -252,11 +252,16 @@
                        );
 
                        if (val.local !== undefined) {
-                               // interwiki-prefix:title style shortcuts
+                               // ./$interwikiPrefix:$title and
+                               // $interwikiPrefix%3A$title shortcuts
                                // are recognized and the local wiki forwards
                                // these shortcuts to the remote wiki
+
                                keys.push(key);
                                patterns.push('^\\.\\/' + val.prefix + 
':(.*?)');
+
+                               keys.push(key);
+                               patterns.push('^' + val.prefix + '%3A(.*?)');
                        }
                });
                var reString = '^(?:' + patterns.join('|') + ')$';
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 37e86cb..a411049 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -25916,13 +25916,33 @@
 !! options
 parsoid=html2wt
 !! html/parsoid
+<p><!--valid shortcut syntax-->
 <a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
-<a href='./fr:Foo'>Foo</a>
+<a href='./fr:Foo'>Foo</a></p>
+<p><!--valid shortcut syntax-->
+<a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
+<a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
+<a href='fr%3AFoo'>Foo</a></p>
+<p><!--invalid shortcut syntax-->
+<a rel='mw:WikiLink' href='fr:Foo'>Foo</a>
+<a rel='mw:ExtLink' href='fr:Foo'>Foo</a>
+<a href='fr:Foo'>Foo</a></p>
 !! wikitext
+<!--valid shortcut syntax-->
 [[:fr:Foo|Foo]]
 [[:fr:Foo|Foo]]
 [[:fr:Foo|Foo]]
+
+<!--valid shortcut syntax-->
+[[:fr:Foo|Foo]]
+[[:fr:Foo|Foo]]
+[[:fr:Foo|Foo]]
+
+<!--invalid shortcut syntax-->
+[[fr:Foo|Foo]]
+[fr:Foo Foo]
+[fr:Foo Foo]
 !! end
 
 # See T93839

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

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

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

Reply via email to