Page MenuHomePhabricator

In complex multi-template scenarios, preserve wikitext newline constraints during html->wt of edited content
Closed, ResolvedPublic0 Estimated Story Points

Description

https://en.wikipedia.org/w/index.php?diff=prev&oldid=673179474 is the diff in question. The required newline before the "{|" has not been respected during serialization.

This seems to be because a {{DISPLAYTITLE:..}} meta-tag that was part of {{Infobox ship begin|..}} has been hoisted out of the table and has captured templating information for the entire infobox. During serialization, Parsoid sees a meta-tag that is part of a transclusion. It does not see a table and does not know to introduce a newline break there. However, since the meta-tag was not part of the source wikitext, but instead came from a template, Parsoid should have ignored it while computing newline constraints.

Event Timeline

Whatamidoing-WMF raised the priority of this task from to Medium.
Whatamidoing-WMF updated the task description. (Show Details)

This is not directly related to tables and seems very specific to cases where there are intervening HTML tags before the table.

In this case, there is a {{DISPLAYTITLE:..}} meta tag (which was in Infobox ship begin) that got fostered out of the table. So, when content before the table is deleted, the meta-tag is interfering with the constraint that forces newlines before tables. Because of the complex templating scenario, parsoid never sees a table tag during serialization. It sees a meta-tag that is template-generated. And, since transclusions don't have any newline constraints, there is no newline break introduced here.

So, the good news is that in the general scenario, we won't break wikitext like this. The bad news is that this is somewhat of an edge case and seems a little sticky ... have to figure out what useful information we can use here that doesn't involve some weird hack.

ssastry renamed this task from Don't remove the line feed/carriage return before a table to In complex multi-template scenarios, preserve wikitext newline constraints during html->wt of edited content.Oct 9 2015, 9:10 PM
ssastry updated the task description. (Show Details)
ssastry updated the task description. (Show Details)
This comment was removed by ssastry.

This does seem to be fostering-related, except it is not marked as fostered because the fostered content comes from a transclusion.

Change 254472 had a related patch set uploaded (by Subramanya Sastry):
WIP: Record first tpl node in multi-template-content-block scenario

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

Change 254472 merged by jenkins-bot:
Record first wikitext node in multi-template-content-block scenario

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