Page MenuHomePhabricator

Terribly malformed table parsed differently than in PHP parser
Closed, ResolvedPublic

Description

This terribly malformed table is parsed differently than in PHP parser:

{| class=wikitable
random text 1
|-
random text 2
| table cell 1
|-
random text 3
| table cell 2
|}

If this is intentional/acceptable difference, please state so and decline. I just found the difference interesting enough to report.

Event Timeline

matmarex raised the priority of this task from to Needs Triage.
matmarex updated the task description. (Show Details)
matmarex added a project: Parsoid.
matmarex subscribed.

This is a known issue ... I could have sworn I had a ticket for it.

But, the general problem is that Parsoid introduces an implicit <td> when bare content is found after a "|-" construct.

If you look in parserTests.txt, I've added comments about implicit <td>s causing diffs between PHP parser and Parsoid. @GWicke and I probably discussed why we ever added that support in the first place, but I cannot remember now. Maybe he remembers and clarify. I imagine it is a side effect of having to support templates after "|-" rows. But, we also have bugs like T71123

But, we should consider removing this support from Parsoid .. or leave it behind as a feature .. not sure what is better.

ssastry triaged this task as Medium priority.Feb 16 2015, 9:52 PM
ssastry set Security to None.
ssastry claimed this task.
[subbu@earth:~/work/wmf/parsoid] php ../mediawiki/maintenance/parse.php < /tmp/wt
parse.php: warning: reading wikitext from STDIN. Press CTRL+D to parse.


random text 1

random text 2

random text 3
<table class="wikitable"><tbody><tr>
<td>table cell 1
</td></tr><tr>
<td>table cell 2
</td></tr></tbody></table>
[subbu@earth:~/work/wmf/parsoid] php bin/parse.php --normalize < /tmp/wt
[warn/dsr/inconsistent] DSR inconsistency: cs/s mismatch for node: tr s:67 ; cs:82
[warn/dsr/inconsistent] DSR inconsistency: cs/s mismatch for node: tr s:35 ; cs:50
[warn/dsr/inconsistent] DSR inconsistency: cs/s mismatch for node: tbody s:18 ; cs:33

<p>random text 1 random text 2 random text 3</p>
<table>
<tbody>
<tr>
<td>table cell 1</td>
</tr>
<tr>
<td>table cell 2</td>
</tr>
</tbody>
</table>