jenkins-bot has submitted this change and it was merged.

Change subject: Always encap fostered content when tmpl range is expanded to 
table
......................................................................


Always encap fostered content when tmpl range is expanded to table

 * This was exposed by e057abe6bea6718a70753e969e6c6f051403cedf.

 * Fixes the duplicate content generated while rt'ing:

     kowiki/박성균?oldid=14967512
     kowiki/송병구?oldid=15031525

Change-Id: I17aa33ee3a9aa67e42dd3f5f00a53fd258c89537
---
M lib/wt2html/pp/wrapTemplates.js
M tests/parserTests.txt
2 files changed, 21 insertions(+), 0 deletions(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/wt2html/pp/wrapTemplates.js b/lib/wt2html/pp/wrapTemplates.js
index d669ff4..420de1f 100644
--- a/lib/wt2html/pp/wrapTemplates.js
+++ b/lib/wt2html/pp/wrapTemplates.js
@@ -224,6 +224,14 @@
                range.start = tcStart;
        }
 
+       // If we have any fostered content, include it as well.
+       if (tcStart.nodeName === 'TABLE') {
+               while (DU.isElt(tcStart.previousSibling) &&
+                               
DU.getDataParsoid(tcStart.previousSibling).fostered) {
+                       range.start = tcStart = tcStart.previousSibling;
+               }
+       }
+
        if (updateDP) {
                updateDSRForFirstTplNode(startElem, tcStart);
        } else if (tcStart === startElem && DU.isElt(tcStart.nextSibling)) {
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 58860e9..324a4e0 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -24342,6 +24342,19 @@
 </table>
 !! end
 
+!! test
+Always encapsulate foster box when template range is expanded to table
+!! options
+parsoid=wt2wt
+!! wikitext
+{|
+hello
+{{OpenTable}}
+|}
+!! html/parsoid
+
+!! end
+
 !!test
 Support <object> element with .data attribute
 !!options

-- 
To view, visit https://gerrit.wikimedia.org/r/252141
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I17aa33ee3a9aa67e42dd3f5f00a53fd258c89537
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Cscott <canan...@wikimedia.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to