diff --git a/extension.json b/extension.json index f44f0e346..992f6de17 100644 --- a/extension.json +++ b/extension.json @@ -151,6 +151,7 @@ "cases/en-big-parsoid/en-big-parsoid.json", "cases/en-big-parsoid/en-big-parsoid-transcludedFrom.json", "cases/en-bigafd-parsoid/en-bigafd-parsoid-transcludedFrom.json", + "cases/transclusions/transclusions-transcludedFrom.json", "cases/pl-big-oldparser/pl-big-oldparser.json", "cases/pl-big-parsoid/pl-big-parsoid.json", "cases/no-heading/no-heading.json", @@ -166,6 +167,7 @@ "cases/en-big-parsoid/en-big-parsoid.html", "cases/en-big-parsoid/en-big-parsoid-modified.html", "cases/en-bigafd-parsoid/en-bigafd-parsoid.html", + "cases/transclusions/transclusions.html", "cases/pl-big-oldparser/pl-big-oldparser.html", "cases/pl-big-oldparser/pl-big-oldparser-modified.html", "cases/pl-big-oldparser/pl-big-oldparser-reply.html", diff --git a/modules/controller.js b/modules/controller.js index d6091e6fe..485ae73a4 100644 --- a/modules/controller.js +++ b/modules/controller.js @@ -335,6 +335,8 @@ function getParsoidCommentData( pageName, oldId, commentId ) { data = response.visualeditor; parsoidDoc = ve.parseXhtml( data.content ); + // Remove section wrappers, they interfere with transclusion handling + mw.libs.ve.unwrapParsoidSections( parsoidDoc.body ); // Mirror VE's ve.init.mw.Target.prototype.fixBase behavior: ve.fixBase( parsoidDoc, document, ve.resolveUrl( // Don't replace $1 with the page name, because that'll break if diff --git a/tests/qunit/cases/transclusions/transclusions-transcludedFrom.json b/tests/qunit/cases/transclusions/transclusions-transcludedFrom.json new file mode 100644 index 000000000..8704091f0 --- /dev/null +++ b/tests/qunit/cases/transclusions/transclusions-transcludedFrom.json @@ -0,0 +1,12 @@ +{ + "Matma Rex|2020-03-04T20:11:00.000Z|0": false, + "Matma Rex|2020-03-04T20:12:00.000Z|0": false, + "Matma Rex|2020-03-04T20:13:00.000Z|0": false, + "Matma Rex|2020-03-04T20:21:00.000Z|0": "Talk:Transcluded subpage", + "Matma Rex|2020-03-04T20:22:00.000Z|0": "Talk:Transcluded subpage", + "Matma Rex|2020-03-04T20:23:00.000Z|0": "Talk:Transcluded subpage", + "Matma Rex|2020-03-04T20:30:00.000Z|0": true, + "Matma Rex|2020-03-04T20:31:00.000Z|0": true, + "Matma Rex|2020-03-04T20:32:00.000Z|0": true, + "Matma Rex|2020-03-04T20:33:00.000Z|0": true +} diff --git a/tests/qunit/cases/transclusions/transclusions.html b/tests/qunit/cases/transclusions/transclusions.html new file mode 100644 index 000000000..1516e9cc5 --- /dev/null +++ b/tests/qunit/cases/transclusions/transclusions.html @@ -0,0 +1,23 @@ + +
Normal comment. Matma Rex (talk) 20:11, 4 March 2020 (UTC)
+Normal comment. Matma Rex (talk) 20:21, 4 March 2020 (UTC)
+Normal comment. Matma Rex (talk) 20:31, 4 March 2020 (UTC)
+