Help:Extension:Linter/unclosed-quotes-in-heading

From MediaWiki.org
Jump to navigation Jump to search
This error is expected to not be very common.

Problem[edit]

Wikitext Output HTML
__TOC__
text
==''foo==
bar
<div class="toc" id="toc">
..
<ul><li>..<i>foo</i>..</li></ul>
..
</div>
<i><p>text</p></i>
<h2><i>foo</i></h2>
<i><p>bar</p></i>

As you can tell, the unclosed quotes causes the i-tag to leak onto the rest of the page from that point on. Moreover, the unclosed tag is added as is to the TOC and then leaks from that point on to the rest of the page which causes the page to look broken.

Solution[edit]

Close unclosed double and triple quotes in headings.

Why does this happen?[edit]

This is the same reason as in the Help:Extension:Linter/pwrap-bug-workaround case and the Help:Extension:Linter/multiline-html-table-in-list cases. 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 RemexHTML to fix it. In this cases, it generates HTML of the form ..<ul><li>..<i>foo</li></ul>..<h2><i>foo</h2></i>. Notice the unclosed <i> tag in the TOC and the misnested <i> tag in the heading.

Tools[edit]

The following tools can help fix unclosed quotes in heading: