Page MenuHomePhabricator

Parser wraps <p> around end of table syntax, following a template that generates HTML table syntax directly...
Closed, DeclinedPublic

Description

Problem: The parser wraps a <p></p> around an end of table marker |} when used with a template that does it's table generation more directly in HTML syntax as I understand it.

Steps to reproduce:
I generated a minimal test case here - https://en.wikisource.org/wiki/User:ShakespeareFan00/Aligned_table_test, The use of the nofooter paramater is per the documentation for the template here :- https://en.wikisource.org/wiki/Template:Aligned_table, to supress the closing </table> tag. In normal tables the |} is used to close the table..

What was the expected behaviour:
A 'balanced' output being the table data, with a proper closure.

What actually happend:
A closed table row per the template, but the |} is misread and converted to a paragraph instead of to a closing </table> tag. The parser treats this as 'fostered' content and relocates, meaning the table genrated is unclosed.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 19 2018, 5:23 PM

Looking at https://en.wikisource.org/wiki/Template:Aligned_table which says the syntax is

{{Aligned table
| whatevercolumn1
| whatevercolumn2
}}

Your example in https://en.wikisource.org/wiki/User:ShakespeareFan00/Aligned_table_test is

{{aligned table|cols=3|style=border-collapse: collapse; width: 100%;
|row1header=yes
|nofooter=yes
|Session and Chapter.
|Title.
|Short Title.}}
|}

so there is some unrelated last line.

Sounds correct to display |} as it's not part of anything before. Whether it should be above your table headers instead of below is a question though.

In general, please provide 1) Steps to reproduce, 2) actual outcome, 3) expected outcome in tasks.
See https://mediawiki.org/wiki/How_to_report_a_bug . Thanks!

ShakespeareFan00 renamed this task from Parser incorrectly wrapping <p> around end of table syntax, following a template that generates HTML table syntax directly... to Parser wraps <p> around end of table syntax, following a template that generates HTML table syntax directly....EditedJun 19 2018, 7:46 PM
ShakespeareFan00 updated the task description. (Show Details)

Thanks, that provides an explanation, but doesn't resolve the issue...

I made an even more minimal example..:-

{|
<tr><td>1</td></tr>
|}

{|
<tr><td>1</td></tr>
</table>

<table>
<tr><td>1</td></tr>
|}

The resultant output being:

<div class="mw-parser-output"><table>
<tr><td>1</td></tr>
<tr><td></td></tr></table>

<table>
<tr><td>1</td></tr>
</table>

<table>
<tr><td>1</td></tr>
<tr><td></td></tr></table>
</div>

Which are all nice and clearly balanced... I fail to see how the parser can handle it in the simple example, but not with the template, when it's an equivalent technique.

You will also note in the first and last examples the generation of additional spurious rows.

Given that aligned table, should be generating appropriately balanced HTML, I fail to see why the parser correctly reads the mixed synatx in one instance and not with the template. Consistency of behavior would be appreciated.

ShakespeareFan00 added a comment.EditedJun 19 2018, 7:57 PM

My text example (link earlier) generates :-

<div class="mw-parser-output"><table style="border-collapse: collapse; width: 100%;"><tr style="vertical-align:top"><th scope="col">Session and Chapter.
</th><th scope="col">Title.
</th><th scope="col">Short Title.</th></tr>
<p>|}
</p></div>

What it should be generating (or could have reasonably expected to generate) is:-

<div class="mw-parser-output"><table style="border-collapse: collapse; width: 100%;"><tr style="vertical-align:top"><th scope="col">Session and Chapter.
</th><th scope="col">Title.
</th><th scope="col">Short Title.</th></tr>
</table>
</p></div>

The line feeds are expected given the layout in the source (tiresome but a different issue.)

(Of course if Mediawiki had PROPER suppport for multi-page continuations, and more explictly defined/doucmented whitespace handling, issues like this one would not arise, I've mentioned this previously, with little apparent impact.)

ShakespeareFan00 closed this task as Declined.Jun 20 2018, 11:17 AM

Closing as declined for now, given that an acceptable workaround was eventually suggested.

The issue of recognising mismatched table syntax in context is a different issue entirely. :) ~~~~

Vvjjkkii renamed this task from Parser wraps <p> around end of table syntax, following a template that generates HTML table syntax directly... to bnaaaaaaaa.Jul 1 2018, 1:03 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
Wargo renamed this task from bnaaaaaaaa to Parser wraps <p> around end of table syntax, following a template that generates HTML table syntax directly....Jul 1 2018, 10:25 AM
Wargo closed this task as Declined.
Wargo lowered the priority of this task from High to Normal.
Wargo updated the task description. (Show Details)
Wargo added a subscriber: Aklapper.
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptWed, Jul 3, 8:38 PM