Jump to content

Hilfe:Lint-Fehler/tidy-font-bug

From mediawiki.org
This page is a translated version of the page Help:Lint errors/tidy-font-bug and the translation is 12% complete.
Only a small selection of font tags used on wikis will be affected by this bug - specifically only font tags that have a color attribute and wrap wikilinks.

The table below demonstrates the problem:

Wikitext Tidy Remex
<font color="green">[[Foo]]</font>
<a href=".."><font color="green">Foo</font></a>
<font color="green"><a href="..">Foo</a></font>

So, with Tidy, the link is now coloured green instead of blue / red (depending on whether the page exists or not) whereas Remex and Parsoid will not do this. This linter category tracks pages with this behaviour so that editors can make appropriate fixes to the wikitext depending on desired rendering.

Solution

To correctly colour a link green, the styling should be brought between the brackets:

[[Foo|<font color="green">Foo</font>]]

Preferentially, the styling should use ‎<span> and the style attribute because ‎<font> is obsolete in HTML 5:

[[Foo|<span style="color:green;">Foo</span>]]

Caveat

However, Tidy does not do this consistently for all cases where a font tag wraps a link or an image tag. See task T294720 for examples. https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/386016/6/tests/mocha/linter.js shows a bunch of wikitext snippets and what Tidy does.

Werkzeuge

The following tools can help fix tidy font bug:

Tidy font bug may be reported by WPCleaner as part of CheckWiki error #535.