Help:Extension:Linter/multiline-html-table-in-list

From MediaWiki.org
Jump to: navigation, search

Problem[edit]

Wikitext Tidy RemexHTML
* <table>
<tr><td>foo</td></tr>
</table>
bar
<table>
<tr>
<td>foo</td>
</tr>
</table>
<p>bar</p>
<ul><li>
<table>
<tbody><tr><td>foo</td></tr>
</tbody></table>
<p>bar</p>
</li></ul>

As one can see, in both cases, the expected result is different from the markup. In Tidy, the list is lost. In Remex, the list extends to the rest of the page. A particularly bad examples is this itwiki revision where multiple lists extend onto the rest of the page.

Solution[edit]

The simplest fix would be to move the table outside the list since that most closely resembles what Tidy does. An alternative fix would be to make the HTML table be on the same line.

When this error is caused through a template, and that template appears in the Wikitext as a bulleted item or at the end of a bulleted or numbered item, often placing the template on a line by itself, without the bullet (coded as *), or number (coded as #), will remove the error. For example, on the English wikipedia, this is typical of {{Commons Category}} (and its alias {{Commonscat}}), {{Commons}}, and {{Authority control}}, among others.

English Wikipedia specific suggestions[edit]

In English Wikipedia, if {{Commons Category}} or {{Commons}} or any aliases thereof is listed in a "References" section, it should be moved down to the "External links" or equivalent section, creating the External links section if necessary. If one of these templates is listed in the "External links" or equivalent section, but not first, it should be placed first in the section. {{Authority control}} should be placed after External links and navigation templates, right before categories. These "shoulds" are not to solve the lint error, but to comply with en:WP:Page layout.

Why does this happen?[edit]

This is the same reason as in the Help:Extension:Linter/pwrap-bug-workaround case. The PHP parser does not have enough information to recognize HTML5 structures. It parses wikitext mostly line-by-line and can misnest HTML tags and relies on Tidy / RemexHTML to fix it up.