Page MenuHomePhabricator

Newlines after bolded text in tables lost on save
Closed, ResolvedPublic

Description

Steps to reproduce

  • Create a table with VE (or edit an existing one)
  • In a table cell, insert two lines of text (separated by a single return)
  • bold the first line
  • save (or preview the wikitext)

Expected result

The newline is preserved in wikitext, with a <br/> or a paragraph.

Actual result

The newline is lost, and the line serializes as

|'''bold'''second line

Event Timeline

GWicke raised the priority of this task from to Needs Triage.
GWicke updated the task description. (Show Details)
GWicke added a project: VisualEditor.
GWicke added subscribers: GWicke, Krenair.

@Jdforrester-WMF, @Catrope: Is this a generic issue for all annotations? What kind of content can it potentially drop after an annotation?

Wait, how is this related to link continuation?

False merge.

Huh. Parsoid issue maybe?

Minimal failing test case for Parsoid:

<table><tr><td><b>Foo</b><p>bar</p></td></tr></table>

->

{|
|'''Foo'''bar
|}

Interestingly if a newline character is inserted between </b> and <p> in the HTML the bug goes away.

Must be some broken newline constraint in the serializer .. or at least an unhandled edge case.

This is a more general issue:

[subbu@earth bin] echo '<b>Foo</b><p>bar</p>' | node parse --html2wt
'''Foo'''bar

With --debug wts, we see this:

[SEP]        |   constraint | sibling | <B,P> | {"a":{},"b":{"min":0,"max":2},"min":0,"max":2} | "<b>Foo</b>" | "<p>bar</p>"

But,

[subbu@earth bin] echo 'Foo<p>bar</p>' | node parse --html2wt
Foo

bar

which in --debug wts mode shows:

[SEP]        |   constraint | sibling | <#text,P> | {"a":{},"b":{"min":2,"max":2},"min":2,"max":2} | "Foo" | "<p>bar</p>"

So, looks like some unhandled scenario in computing newline constraints for P-tags

Change 257032 had a related patch set uploaded (by Subramanya Sastry):
T104032: Fix html2wt newline constraints for paragraphs

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

Change 257032 merged by jenkins-bot:
T104032: Fix html2wt newline constraints for paragraphs

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

ssastry removed a project: Patch-For-Review.
ssastry edited a custom field.
ssastry removed a subscriber: gerritbot.