Arlolra has uploaded a new change for review.

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

Change subject: T141905: Fix crasher in table fixups
......................................................................

T141905: Fix crasher in table fixups

 * hoistTransclusionInfo expects the parent cell to have valid dsr info,
   but in handleTableCellTemplates we're creating elements w/o it.

 * A snipit pruned from /nn.wikipedia.org/v3/page/html/Bilen/2808132

   {|
   !a!!{{1x|b!!{{1x|c}}!!{{1x|d!!e
   |}

   : f

   could be used for a test case, but it's pretty broken wikitext.
   What's interesting is that we get a different parse for the table if
   the following list is absent.  Going to investigate that separately.

Change-Id: Ia2ffeecec2f7c361754449b58bcf2ed5943e75db
---
M lib/wt2html/pp/handlers/tableFixups.js
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/53/312553/1

diff --git a/lib/wt2html/pp/handlers/tableFixups.js 
b/lib/wt2html/pp/handlers/tableFixups.js
index 66c4497..0e7aaf9 100644
--- a/lib/wt2html/pp/handlers/tableFixups.js
+++ b/lib/wt2html/pp/handlers/tableFixups.js
@@ -100,9 +100,16 @@
        var dp = DU.getDataParsoid(tdNode);
        var childDP = DU.getDataParsoid(child);
 
+       // In `handleTableCellTemplates`, we're creating a cell w/o dsr info.
+       if (!Util.isValidDSR(dp.dsr)) {
+               dp.dsr = Util.clone(childDP.dsr);
+       }
+
        // Get the td and content source up to the transclusion start
        if (dp.dsr[0] < childDP.dsr[0]) {
                parts.unshift(env.page.src.substring(dp.dsr[0], 
childDP.dsr[0]));
+       } else {
+               dp.dsr[0] = childDP.dsr[0];
        }
 
        // Add wikitext for the table cell content following the
@@ -112,6 +119,8 @@
        // itself.
        if (childDP.dsr[1] < dp.dsr[1]) {
                parts.push(env.page.src.substring(childDP.dsr[1], dp.dsr[1]));
+       } else {
+               dp.dsr[1] = childDP.dsr[1];
        }
 
        // Save the new data-mw on the tdNode

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2ffeecec2f7c361754449b58bcf2ed5943e75db
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>

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

Reply via email to