jenkins-bot has submitted this change and it was merged. ( 
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

* Filed T181657 to discuss deprecating the body only mode.

Change-Id: I7b2bcff432783cc3367d01d7103c742ba3e0e2d9
---
M lib/api/routes.js
M tests/mocha/api.js
2 files changed, 10 insertions(+), 0 deletions(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  C. Scott Ananian: Looks good to me, approved
  jenkins-bot: Verified



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 92a1346..4d2208a 100644
--- a/tests/mocha/api.js
+++ b/tests/mocha/api.js
@@ -786,6 +786,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);
                });
@@ -802,6 +804,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: merged
Gerrit-Change-Id: I7b2bcff432783cc3367d01d7103c742ba3e0e2d9
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: C. Scott Ananian <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Sbailey <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to