Subramanya Sastry has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/393850 )
Change subject: T181226: Don't emit <section> wrappers in body only mode
......................................................................
T181226: Don't emit <section> wrappers in body only mode
* We can separately discussing deprecating the body only mode that we
have been considering.
Change-Id: I7b2bcff432783cc3367d01d7103c742ba3e0e2d9
---
M lib/api/routes.js
M tests/mocha/api.js
2 files changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/50/393850/1
diff --git a/lib/api/routes.js b/lib/api/routes.js
index 348e1e8..d09d554 100644
--- a/lib/api/routes.js
+++ b/lib/api/routes.js
@@ -405,6 +405,12 @@
var oldid = res.locals.oldid;
var target = env.normalizeAndResolvePageTitle();
+ // VE, the only client using bodyOnly property,
+ // doesn't want section tags when this flag is set.
+ if (res.locals.bodyOnly) {
+ env.wrapSections = false;
+ }
+
var pageBundle = !!(res.locals.opts && res.locals.opts.format
=== 'pagebundle');
env.pageBundle = pageBundle;
diff --git a/tests/mocha/api.js b/tests/mocha/api.js
index a23aa2e..e214931 100644
--- a/tests/mocha/api.js
+++ b/tests/mocha/api.js
@@ -764,6 +764,8 @@
// v3 only returns children of <body>
res.body.html.body.should.not.match(/<body/);
res.body.html.body.should.match(/<p/);
+ // No section wrapping in body-only mode
+ res.body.html.body.should.not.match(/<section/);
})
.end(done);
});
@@ -780,6 +782,8 @@
// v3 only returns children of <body>
res.text.should.not.match(/<body/);
res.text.should.match(/<p/);
+ // No section wrapping in body-only mode
+ res.text.should.not.match(/<section/);
})
.end(done);
});
--
To view, visit https://gerrit.wikimedia.org/r/393850
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b2bcff432783cc3367d01d7103c742ba3e0e2d9
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