Arlolra has uploaded a new change for review.
https://gerrit.wikimedia.org/r/283590
Change subject: storeDataParsoid is an env variable, not a Parsoid config
......................................................................
storeDataParsoid is an env variable, not a Parsoid config
Change-Id: I23efe102dc99695456377c5c59073e0ddfba1030
---
M bin/parse.js
M lib/config/MWParserEnvironment.js
M lib/config/ParsoidConfig.js
M lib/utils/Util.js
4 files changed, 12 insertions(+), 16 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/90/283590/1
diff --git a/bin/parse.js b/bin/parse.js
index 6aee795..85dc674 100755
--- a/bin/parse.js
+++ b/bin/parse.js
@@ -102,6 +102,11 @@
'boolean': false,
'default': false,
},
+ 'dp': {
+ description: 'Output data-parsoid JSON',
+ 'boolean': true,
+ 'default': false,
+ },
'dpinfile': {
description: 'Input data-parsoid JSON file',
'boolean': false,
@@ -215,6 +220,10 @@
// Enable wikitext scrubbing
env.scrubWikitext = argv.scrubWikitext;
+ // Sets ids on nodes and stores data-parsoid attributes
+ // in a JSON blob in the head.
+ env.storeDataParsoid = argv.dp;
+
if (!argv.wt2html) {
if (argv.oldtextfile) {
argv.oldtext =
fs.readFileSync(argv.oldtextfile, 'utf8');
diff --git a/lib/config/MWParserEnvironment.js
b/lib/config/MWParserEnvironment.js
index 7f3d550..2b3796a 100644
--- a/lib/config/MWParserEnvironment.js
+++ b/lib/config/MWParserEnvironment.js
@@ -74,9 +74,9 @@
console.assert(parsoidConfig.mwApiMap.has(options.prefix));
this.conf.wiki = new WikiConfig(this, null, options.prefix);
- // Store this in the environment to manipulate it on each request,
- // if necessary. Avoids having to clone the config.
- this.storeDataParsoid = parsoidConfig.storeDataParsoid;
+ // Sets ids on nodes and stores data-parsoid attributes
+ // in a JSON blob in the head.
+ this.storeDataParsoid = false;
this.linter = new Linter(this);
this.configureLogging();
diff --git a/lib/config/ParsoidConfig.js b/lib/config/ParsoidConfig.js
index 1d47ae1..36ba1f1 100644
--- a/lib/config/ParsoidConfig.js
+++ b/lib/config/ParsoidConfig.js
@@ -271,11 +271,6 @@
ParsoidConfig.prototype.DATA_PARSOID_VERSION = '0.0.2';
/**
- * @property {boolean} storeDataParsoid
- */
-ParsoidConfig.prototype.storeDataParsoid = false;
-
-/**
* @property {boolean} addHTMLTemplateParameters
* When processing template parameters, parse them to HTML and add it to the
* template parameters data.
diff --git a/lib/utils/Util.js b/lib/utils/Util.js
index cb2677a..a25ecc1 100644
--- a/lib/utils/Util.js
+++ b/lib/utils/Util.js
@@ -212,9 +212,6 @@
parsoidConfig.maxDepth = typeof (opts.maxdepth) ===
'number' ?
opts.maxdepth : parsoidConfig.maxDepth;
}
- if (opts.dp !== undefined) {
- parsoidConfig.storeDataParsoid =
Util.booleanOption(opts.dp);
- }
if (opts.apiURL) {
parsoidConfig.setMwApi({ prefix: 'customwiki', uri:
opts.apiURL });
}
@@ -340,11 +337,6 @@
},
'rtTestMode': {
description: 'Test in rt test mode (changes
some parse & serialization strategies)',
- 'boolean': true,
- 'default': false,
- },
- 'dp': {
- description: 'Output data-parsoid JSON',
'boolean': true,
'default': false,
},
--
To view, visit https://gerrit.wikimedia.org/r/283590
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I23efe102dc99695456377c5c59073e0ddfba1030
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits