Page MenuHomePhabricator

Parsoid: Automatic newline prepending to table-template causes incorrect rendering and messed up HTML in Parsoid parser
Closed, ResolvedPublic

Description

+++ This bug was initially created as a clone of Bug #68297 +++

On mediawiki.org, there is a family on fancy templates like [[mw:Template:MW 1.23]] that generate a right-floated MediaWiki version number in a frame.

These templates generate a wikitext table (starting with '{|'), which means that due to bug 529 / bug 12974 a newline is prepended before it. This behavior is incredibly annoying in practice, but it seems that we're very much wedded to it because it made Parsoid people's lives easier.

However, Parsoid rendering of this particular template is inconsistent with PHP. On [[mw:Manual:Skinning#Localisation_messages]], PHP generates an empty paragraph before the table, while Parsoid doesn't and produces an about-grouped pair of <span>\n</span><table>…</table> (the span tag only contains the prepended newline).

This rendering, that looks good in Parsoid/VisualEditor, therefore looks like crap in PHP parser.

Note that the <span> is not nested in a <p> or any other block-level element, it just sits there right in the <body>. (It is not visible since, as I mentioned, it just contains some whitespace.)


Version: unspecified
Severity: major

Details

Reference
bz68862

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:36 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz68862.
Arlolra triaged this task as Medium priority.Dec 18 2014, 8:01 PM
Arlolra subscribed.

The php parser no longer seems to generate an empty paragraph and the parsoid output seems comparable. The span wrapping of the newline is to mark it as template generated for suppressing on roundtrip.

The _rtselser/mediawikiwiki/Manual:Skinning?oldid=1072136 seems fine.

But of note,

echo "{{MW 1.22|and later}} MediaWiki 1.22 added support for <code>." | node parse --prefix mediawikiwiki --wt2wt
{{MW 1.22|and later}}
<nowiki> </nowiki>MediaWiki 1.22 added support for <code>.
ssastry claimed this task.
[subbu@earth:~/work/wmf/parsoid] echo "{{MW 1.22|and later}} MediaWiki 1.22 added support for <code>." | php bin/parse.php --domain www.mediawiki.org --wt2wt
{{MW 1.22|and later}} MediaWiki 1.22 added support for <code>.