Page MenuHomePhabricator

Ignore whitespaces between wiki table syntax and table content
Closed, DuplicatePublic

Description

Wiki text:

{|
|+ ?
|-
! ? !! ? || ? !! | ?
! ?
|-
| ? || ? || | ?
| ?
|}

Current HTML output:

<table>
<caption>&#160;?
</caption>
<tr>
<th>&#160;? </th>
<th>&#160;? </th>
<th>&#160;? </th>
<th>&#160;?
</th>
<th>&#160;?
</th></tr>
<tr>
<td>&#160;? </td>
<td>&#160;? </td>
<td>&#160;?
</td>
<td>&#160;?
</td></tr></table>

Expected HTML output:

<table>
<caption>?</caption><tr>
<th>?</th>
<th>?</th>
<th>?</th>
<th>?</th>
<th>?</th></tr><tr>
<td>?</td>
<td>?</td>
<td>?</td>
<td>?</td></tr></table>

Event Timeline

Change 395477 had a related patch set uploaded (by Eflyjason; owner: Eflyjason):
[mediawiki/core@master] parser - Ignore whitespaces between wiki table syntax and table content

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

eflyjason raised the priority of this task from Low to Needs Triage.Dec 15 2017, 12:06 PM

By the way, currently Wikipedia already has the expected output because of Tidy (https://www.w3.org/People/Raggett/tidy/). But I think this patch is still needed for general Mediawiki sites.

Yes, for ensuring consistency (there can be different parsers, across Special:ExpandTemplates, preview mode, etc.)

And it's bad to rely on the subsequent parsing layer to fix the output...

Change 395477 abandoned by Eflyjason:
Parser: Ignore whitespaces between wiki table syntax and table content

Reason:
"This has been fixed generally as part of https://phabricator.wikimedia.org/T157418"

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

The current result of the test case is

<table>
<caption>?
</caption>
<tbody><tr>
<th>?</th>
<th>?</th>
<th>?</th>
<th>?
</th>
<th>?
</th></tr>
<tr>
<td>?</td>
<td>?</td>
<td>?
</td>
<td>?
</td></tr></tbody></table>

The &#160;s are now away.