Page MenuHomePhabricator

Mismatched tags in rendered HTML
Closed, DeclinedPublic

Description

If you look at the HTML source for the URL above, you will see that the <code> tag in the wiki source is incorrectly rendered as:

<p><code>
</p>

This leaves the <code> tag unclosed (though it's later closed in a similar mismatched block). While various tidiers will clean this in different ways, those wikis that don't have tidying enabled, as above, will emit pages with invalid HTML. Even for those that do, the handling of the tags changes from one implementation to the next. (In testing the bug on different wikis, I found unfixed, rendered as <p>&lt;code> and completely re-written inside of <pre> tags, as is done on MW.)


Version: 1.22.2
Severity: minor
URL: http://sourceforge.net/apps/mediawiki/dotnetwikibot/index.php?title=Main_Page

Details

Reference
bz26047

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:15 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz26047.
bzimport added a subscriber: Unknown Object (MLST).

I think that misses the point, as without any extensions or cleaners, there's still a bug in the output of the PHP script.

rbairos wrote:

Ive just come across this bug as well.
We are trying to create a html render of our documentation, which involves parsing the html output and trimming out irrelevant sections.
However as the tags don't match, our parser breaks down.
We are using MediaWiki 1.18.0

MW 1.18.x is not supported anymore. Please upgrade and report back.

Still occurs in 1.22.x. Simple case is as follows:
<code>
Test
</code>

It's the space in front of test that creates the anomaly. Removing the space, which of course gives you plain text instead of pre-style text, wraps the entire code block in a <p> as you would expect, rather than wrapping each of the start and end code tags in a <p>.

rbairos wrote:

Will this bug ever be addressed? It's been four years and relies on every html renderer to work around the bad output.

rbairos wrote:

Sorry for the gripe (using 1.23.3). Just figured this affects most everyone.

The bug report is low priority - a patch would speed up fixing it. See https://www.mediawiki.org/wiki/How_to_become_a_MediaWiki_hacker for more info.

Izno subscribed.

This will no longer be cleaned up per Remex efforts.