Page MenuHomePhabricator

Foster-parented transclusion content not encapsulated- causes dirty diff
Closed, ResolvedPublic

Description

Test case:
echo '<table>{{echo|foo<tr><td>bar</td></tr>}}</table>' | node parse

WARNING: DSR inconsistency: cs/s mismatch for node: BODY s: 0; cs: -3 <body data-parsoid='{"dsr":[0,49,0,0]}'>foo<table data-parsoid='{"stx":"html","dsr":[0,48,7,8]}'><tbody about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<tr><td>bar</td></tr>"}},"i":0}' data-parsoid='{"dsr":[7,40,null,null],"pi":[[{"k":"1","spc":["","","",""]}]]}'><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>bar</td></tr></tbody></table> </body>

The foster-parented 'foo' is not marked as transclusion-affected, which will cause a dirty diff on round-trip:

echo '<table>{{echo|foo<tr><td>bar</td></tr>}}</table>' | node parse --wt2wt

WARNING: DSR inconsistency: cs/s mismatch for node: BODY s: 0; cs: -3 foo<table>{{echo|foo<tr><td>bar</td></tr>}}</table>

Version: unspecified
Severity: normal

Details

Reference
bz52945

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:51 AM
bzimport added a project: Parsoid-DOM.
bzimport set Reference to bz52945.

Change 82647 had a related patch set uploaded by Arlolra:
WIP: Discard foster-parented transclusion content

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

An edge case that I noticed here,

echo "{{echo|<table><tr>}}foo<td>bar</td></tr></table>" | node parse
echo "{{echo|<table><tr>}}<p>foo</p><td>bar</td></tr></table>" | node parse
echo "{{echo|<table><tr>foo}}<td>bar</td></tr></table>" | node parse

the transclusion info gets added to the fostered content resulting in an error,

ERROR: Do not have necessary info. to encapsulate Tpl: 0

Change 82647 merged by Arlolra:
Encapsulate foster-parented transclusion content.

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