Page MenuHomePhabricator

Parsoid creates incorrect wikitext by letting a user remove the newline between template and the start of a heading
Closed, ResolvedPublic0 Estimated Story Points

Description

When the User removes stuff between a heading and a template VisualEditor creates incorrect wikitext by removing the last newline between template and heading, thus the heading is not parsed.

Example is the edit before this one: https://www.mediawiki.org/w/index.php?title=Requests_for_comment/Streamlining_Composer_usage&diff=next&oldid=1747181

Event Timeline

JanZerebecki raised the priority of this task from to Needs Triage.
JanZerebecki updated the task description. (Show Details)
JanZerebecki added a project: VisualEditor.
JanZerebecki subscribed.
Jdforrester-WMF moved this task from To Triage to TR1: Releases on the VisualEditor board.
Jdforrester-WMF renamed this task from creates incorrect wikitext by removing last newline between template and heading to Parsoid creates incorrect wikitext by letting a user remove the newline between template and the start of a heading.Jul 22 2015, 1:05 AM
This comment was removed by ssastry.

When I open this old revision in VE and make the same changes and 'Review Changes' in the save dialog, I can consistently reproduce this bug.

However, this one is proving to be a difficult customer to replicate locally .. even when I dump the old and edited HTML from the VE session, and get data-parsoid from RESTBase, and then run selser locally on those 3 files.

Have to figure out how to reproduce this locally before this can be fixed. But, this one also seems like some edge case behavior because Parsoid has newline constraints that force a newline before headings.

I don't know how I tested it back in October, but I can reproduce this locally as well now.

Looks like the fix for T86271 will fix this bug as well, but will separately investigate how to be smarter about computing newline constraints when one of the nodes involved comes from a template.

I don't know how I tested it back in October, but I can reproduce this locally as well now.

I suspect I might have been on a local branch that had a fix for T86271 in place given that I started work on that patch (now reverted) around Sep 21st. Anyway, now to actually fix this independent of that fix.

I don't know how I tested it back in October, but I can reproduce this locally as well now.

I suspect I might have been on a local branch that had a fix for T86271 in place given that I started work on that patch (now reverted) around Sep 21st. Anyway, now to actually fix this independent of that fix.

The fix is to tweak the code that is removed in https://gerrit.wikimedia.org/r/#/c/249962/7/lib/html2wt/separators.js .. so, I am just going to wait for that patch to be reviewed.