Page MenuHomePhabricator

Linter does not detect font link error when sup tags are inside the font color tags
Open, LowPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Put code on a page that looks like this:
<font color="green"><sup>[[User talk:Foo|''talk'']]</sup></font>

What happens?:
See https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox2&oldid=1052963907.

The link shows as red or blue instead of green, indicating that there is a high-priority font link Linter error. LintHint and Page Information will show an obsolete tag error, but not a font link error.

If you remove the sup tags, the font link error is detected.

What should have happened instead?:
LintHint and Page Information should show an obsolete tag error and a font link error.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:

Event Timeline

> php bin/parse.php --pageName "User:Jonesey95/sandbox2" --linting < /dev/null
{"type":"obsolete-tag","dsr":[73,137,20,7],"params":{"name":"font"}}

I don't think MediaWiki-extensions-Linter is the right tag here

Sorry, what I was trying to communicate in T294720#7472261 was that Parsoid is correctly detecting this as an obsolete tag

Arlolra moved this task from Needs Triage to Linting on the Parsoid board.

The link shows as red or blue instead of green, indicating that there is a high-priority font link Linter error.

Yikes, I really didn't read this ticket description well, my apologies. The error you're looking for is "tidy-font-bug", or "Old behaviour of link-wrapping font tags",
https://github.com/wikimedia/parsoid/blob/master/src/Wt2Html/PP/Processors/Linter.php#L619-L673

Tidy is deprecated and the replacement, Remex, doesn't do the font tag migration. The reason this was a high priority task was for compatibility before switching over to Remex. Remex has been in production for quite some time now and the visual difference in this case hasn't been an issue.

We should think about deprioritizing some of these tidy tasks now.

Also, it would need to be verified that tidy did actually do the migration of font tags in the presence of sup, since there are cases where it didn't and the whole point of linting this was to keep the content rendering identically after the switch to Remex.

To be clear: LintHint and Page Information should report one of these errors: https://www.mediawiki.org/wiki/Help:Lint_errors/tidy-font-bug. The error has gone by a few different names since Linter was implemented.

It should report this error in addition to the obsolete tag error caused by the font tag.

Interestingly, this code reports a Tidy font link error:

<font color="purple">[[User talk:Persian Poet Gal|<sup>(talk)</sup>]]</font>

To be clear: LintHint and Page Information should report one of these errors: https://www.mediawiki.org/wiki/Help:Lint_errors/tidy-font-bug. The error has gone by a few different names since Linter was implemented.

It should report this error in addition to the obsolete tag error caused by the font tag.

Not necessarily, see T294720#7472699

Here's another flavor of an undetected "Old behaviour of link-wrapping font tags" Linter error:

This one is two wikilinks inside a single font tag that attempts and fails to assign a color, like this:

<font color="#333333">[[User:MC10#top|M]][[User talk:MC10#top|C]]</font>

To show that it is two links, not just this kind of anchored link, I added a single link immediately after the problem case.

https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox2&oldid=1057705046

This code should show an "Old behaviour of link-wrapping font tags", aka tidy-font-bug, Linter error.

If you look at the three other lines on that page, you can see a properly flagged tidy-font-bug error, properly colored text using font tags inside the brackets, and unformatted linked text for comparison.

If anyone gets around to fixing this bug, here are additional examples of undetected "Old behaviour of link-wrapping font tags" Linter errors:

https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox2&oldid=1080187729

Is there a reason that this bug is stalled? Tidy font link errors are listed as "high-priority" errors by the Wikimedia developers, but this bug has not received high-priority attention.

Here's another flavor of an undetected "Old behaviour of link-wrapping font tags" Linter error:

This one is two wikilinks inside a single font tag that attempts and fails to assign a color, like this:

<font color="#333333">[[User:MC10#top|M]][[User talk:MC10#top|C]]</font>

Looking at https://github.com/wikimedia/mediawiki-services-parsoid/blob/master/src/Wt2Html/PP/Processors/Linter.php#L621-L644 the code comment says,

			 * Tidy does not migrate <font> into the link in these cases
...
			 *     <font>[[Foo]][[Bar]]</font>

This doesn't seem undetected, but rather explicitly omitted.

The tidy-font-bug lint was introduced to flag cases where we'd have rendering differences between Tidy and Remex, and in this case it doesn't seem like there would have been any.

If anyone gets around to fixing this bug, here are additional examples of undetected "Old behaviour of link-wrapping font tags" Linter errors:

https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox2&oldid=1080187729

It's not enough to show that the font colour is suppressed. It needs to be a case where Tidy would have migrated the font into the link.

Here's another pair of similar instances that are not detected:

<font color="white">[[Wikipedia:Administrators|Sysop]] foo</font>

<font color="darkorange"> [[User:Tnxman307|TN]]</font>

Note the spaces.