Page MenuHomePhabricator

Broken serialization of a table row when a cell is edited to included paragraph breaks
Closed, DuplicatePublic0 Estimated Story Points

Description

See https://en.wikipedia.org/w/index.php?title=X86&diff=728898840&oldid=728897826

Given a table that (unknown to the user) has its wikitext like this:

{|
|-
| '''5th''' ([[Superscaler]]) || 1993 || [[P5 (microarchitecture)|Pentium]], [[Pentium MMX]],  [[Rise Technology|Rise]] [[mP6]] || [[Superscalar]] [[64-bit]] [[Bus (computing)|databus]], faster FPU, [[MMX (instruction set)|MMX]] (2× 32-bit), [[Socket 7]]
|-
|}

If you add line breaks/new paragraphs to a cell, then you get a table-breaking mess when you save the page:

{|
|-
| '''5th''' ([[Superscaler]])

My new paragraph here

My next paragraph here  

|| 1993 || [[P5 (microarchitecture)|Pentium]], [[Pentium MMX]],  [[Rise Technology|Rise]] [[mP6]] || [[Superscalar]] [[64-bit]] [[Bus (computing)|databus]], faster FPU, [[MMX (instruction set)|MMX]] (2× 32-bit), [[Socket 7]]
|-
|}

There is no way for the editor to know that adding a paragraph to this particular table is going to break everything. Instead, the entire row ought to be saved in the non-single-row format.

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald Transcript
ssastry renamed this task from VisualEditor does not play well with tables that use the single row format to Broken serialization of a table row when a cell is edited to included paragraph breaks.Jul 8 2016, 6:24 PM
ssastry triaged this task as Medium priority.
ssastry subscribed.

This doesn't need edits necessarily, but, since data-parsoid exists only on original content, this behavior is only triggered on edits. The stx_v:row annotation needs to be ignored by the serializer here since the previous cell has a paragraph break.

[subbu@earth parsoid] cat /tmp/new.html
<table><tr><td><p>a</p><p>b</p></td><td data-parsoid='{"stx_v":"row"}'>bar</td></tr></tbody></table>
[subbu@earth parsoid] parse.js --html2wt < /tmp/new.html
{|
|a

b
||bar
|}
Jdforrester-WMF moved this task from To Triage to TR0: Interrupt on the VisualEditor board.