Cscott has uploaded a new change for review.
https://gerrit.wikimedia.org/r/235128
Change subject: Allow access to Parsoid and SiteInfo modules.
......................................................................
Allow access to Parsoid and SiteInfo modules.
This is used to implement a "standalone mode" in mw-ocg-texter.
Change-Id: If0a8a42d53c19491f36ef77eedef60ed980b5d02
---
M lib/index.js
M lib/parsoid.js
2 files changed, 12 insertions(+), 0 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection/OfflineContentGenerator/bundler
refs/changes/28/235128/1
diff --git a/lib/index.js b/lib/index.js
index 46950b6..503c0de 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -35,6 +35,10 @@
// Allow access to the metabook creation/repair functions
module.exports.metabook = Metabook;
+// Allow access to the Parsoid/RESTBase download functions
+module.exports.parsoid = Parsoid;
+// Allow access to SiteInfo (this caches site information)
+module.exports.siteinfo = SiteInfo;
// Returns a promise to create the given bundle, which resolves with no
// value when the bundle is created successfully.
diff --git a/lib/parsoid.js b/lib/parsoid.js
index 14a2026..4d78d2a 100644
--- a/lib/parsoid.js
+++ b/lib/parsoid.js
@@ -11,6 +11,7 @@
var util = require('util');
var P = require('./p');
+var SiteInfo = require('./siteinfo');
// limit the # of concurrent requests to parsoid.
var PARSOID_REQUEST_LIMIT = 5;
@@ -173,6 +174,13 @@
var fetch = function(siteinfo, wiki, title, revid /* optional */,
max_redirects /* optional */, status /* optional */) {
wiki = wiki || 0;
max_redirects = max_redirects || 0;
+ // allow external use of this API w/o access to the SiteInfo module
+ if (!siteinfo) {
+ return new SiteInfo(this.wikis,
this.log).fetch(wiki).then(function(si) {
+ return this.fetch(si, wiki, title, revid,
max_redirects, status);
+ }.bind(this));
+ }
+
var prefix = this.wikis[wiki].prefix;
if (status) {
// this is inside the guard, so if we launch lots of fetches in
--
To view, visit https://gerrit.wikimedia.org/r/235128
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If0a8a42d53c19491f36ef77eedef60ed980b5d02
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Collection/OfflineContentGenerator/bundler
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits