GWicke has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/79817


Change subject: Bugs 50603, 50589: Handle nested templates as well
......................................................................

Bugs 50603, 50589: Handle nested templates as well

This adds a slightly hacky work-around that enabled the TD fixup even for
nested transclusions as found on
http://en.wikipedia.org/wiki/5_O%27Clock_%28T-Pain_song%29.

We don't encapsulate nested transclusion content on the DOM, but (currently)
leave in data-parsoid.src. This patch uses that to detect the
|{{echo|{{!}}foo}} case.

In the longer term we'd like to remove data-parsoid.src for nested content. We
should think about a cleaner way to handle this, potentially by marking up
nested templates somehow.

Change-Id: Ib3cdaaf2712f7a7513af47df14a46a67d01fb407
---
M js/lib/dom.t.TDFixups.js
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/17/79817/1

diff --git a/js/lib/dom.t.TDFixups.js b/js/lib/dom.t.TDFixups.js
index e5ea8ee..65fb3ad 100644
--- a/js/lib/dom.t.TDFixups.js
+++ b/js/lib/dom.t.TDFixups.js
@@ -14,9 +14,12 @@
                nextNode !== null &&
            nextNode.nodeName === 'TD' &&
            !DU.isLiteralHTMLNode(nextNode) &&
-               // FIXME: will not be set for nested templates
-               DU.isEncapsulatedElt(nextNode) &&
-           DU.nodeEssentiallyEmpty(node))
+               DU.nodeEssentiallyEmpty(node) &&
+               (// FIXME: will not be set for nested templates
+                DU.isEncapsulatedElt(nextNode) ||
+                // Hacky work-around for nested templates
+                /^{{.*?}}$/.test(nextNode.data.parsoid.src))
+           )
        {
                // Update the dsr. Since we are coalescing the first
                // node with the second (or, more precisely, deleting

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3cdaaf2712f7a7513af47df14a46a67d01fb407
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>

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

Reply via email to