Cscott has uploaded a new change for review.
https://gerrit.wikimedia.org/r/284356
Change subject: Send Accept header to Parsoid/RESTBase to get data-mw
attributes inline.
......................................................................
Send Accept header to Parsoid/RESTBase to get data-mw attributes inline.
Change-Id: I336eee1339f686446a6bfdd04b52981cc69e3d39
---
M lib/parsoid.js
1 file changed, 8 insertions(+), 2 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection/OfflineContentGenerator/bundler
refs/changes/56/284356/1
diff --git a/lib/parsoid.js b/lib/parsoid.js
index 06f6a53..936a5bd 100644
--- a/lib/parsoid.js
+++ b/lib/parsoid.js
@@ -17,6 +17,12 @@
// Limit the # of concurrent requests to parsoid.
var PARSOID_REQUEST_LIMIT = 5;
+// Add `Accept` header to get data-mw attributes inline.
+var pheaders = {};
+Object.keys(headers).forEach(function(k) { pheaders[k] = headers[k]; });
+pheaders['Accept'] =
+ 'text/html; charset=utf-8; profile="mediawiki.org/specs/html/1.2.1"';
+
// Escape special regexp characters in a string.
// Used to build a regexp matching a literal string.
var escapeRegExp = function(s) {
@@ -229,7 +235,7 @@
}
var apiURL = findApiUrl('GET', this.apiVersion, this.wikis[wiki],
title, revid);
- request({ url: apiURL.url, encoding: 'utf8', headers: headers, pool:
false, log: this.log }, function(error, response, body) {
+ request({ url: apiURL.url, encoding: 'utf8', headers: pheaders, pool:
false, log: this.log }, function(error, response, body) {
if (error || response.statusCode !== 200) {
deferred.reject(new Error('Error fetching ' +
apiURL.api + ' result: ' + apiURL.url + ' ' + (error || response.statusCode)));
} else {
@@ -255,7 +261,7 @@
url: apiURL.url,
method: 'POST',
encoding: 'utf8',
- headers: headers,
+ headers: pheaders,
pool: false,
log: this.log,
form: (
--
To view, visit https://gerrit.wikimedia.org/r/284356
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I336eee1339f686446a6bfdd04b52981cc69e3d39
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