GWicke has submitted this change and it was merged.

Change subject: Add --prefix option to tests/parse.js to more easily test i18n.
......................................................................


Add --prefix option to tests/parse.js to more easily test i18n.

This now works:
echo '[[Archivo:Nombre|thumb|alttext]]' | node tests/parse.js  --prefix=es

gwicke: Also rename wgScript to apiURL and remove the unused wgScriptPath and
fetchConfig options.

Change-Id: I265d4cd38d9ce5964cf9be4ba59068516c016cf6
---
M js/tests/parse.js
1 file changed, 11 insertions(+), 19 deletions(-)

Approvals:
  GWicke: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/js/tests/parse.js b/js/tests/parse.js
index 942e32a..0e2e146 100644
--- a/js/tests/parse.js
+++ b/js/tests/parse.js
@@ -119,20 +119,15 @@
                        'boolean': false,
                        'default': 40
                },
-               'wgScript': {
-                       description: 'http path to remote API, e.g. 
http://wiki.sample.com/w/api.php',
+               'prefix': {
+                       description: 'Which wiki prefix to use; e.g. "en" for 
English wikipedia, "es" for Spanish, "mw" for mediawiki.org',
                        'boolean': false,
-                       'default': 'http://en.wikipedia.org/w/api.php'
+                       'default': ''
                },
-               'wgScriptPath': {
-                       description: 'http path to remote web interface, e.g. 
http://wiki.sample.com/wiki',
+               'apiURL': {
+                       description: 'http path to remote API, e.g. 
http://en.wikipedia.org/w/api.php',
                        'boolean': false,
-                       'default': 'http://en.wikipedia.org/wiki/'
-               },
-               'fetchConfig': {
-                       description: 'Whether to call an API to fetch the 
configuration we need',
-                       'boolean': true,
-                       'default': false
+                       'default': null
                },
                'fetchTemplates': {
                        description: 'Whether to fetch included templates 
recursively',
@@ -176,17 +171,14 @@
                argv.wt2html = true;
        }
 
-       var prefix = null;
+       var prefix = argv.prefix || null;
 
-       if ( argv.fetchConfig ) {
-               prefix = 'en';
+       if (argv.apiURL) {
+               parsoidConfig.setInterwiki( 'customwiki', argv.apiURL );
+               prefix = 'customwiki';
        }
 
-       var parsoidConfig = new ParsoidConfig( null, null );
-       if ( argv.wgScript && argv.fetchConfig ) {
-               parsoidConfig.setInterwiki( 'alternate', argv.wgScript );
-               prefix = 'alternate';
-       }
+       var parsoidConfig = new ParsoidConfig( null, { defaultWiki: prefix } );
 
        ParserEnv.getParserEnv( parsoidConfig, null, prefix, argv.pagename || 
null, function ( err, env ) {
                if ( err !== null ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I265d4cd38d9ce5964cf9be4ba59068516c016cf6
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to