Page MenuHomePhabricator

Conflicting border/thumb/frame options are not detected as Linter errors
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:
Put this in a sandbox on en.WP:

[[File:Kralicky-Sneznik-03.jpg|thumb|border|left|Rolling hills of the [[Králický Sněžník]] massif, [[Dolní Morava|Horní Morava]], near the border with [[Bohemia]].]]

[[File:Kralicky-Sneznik-03.jpg|frame|border|left|Rolling hills of the [[Králický Sněžník]] massif, [[Dolní Morava|Horní Morava]], near the border with [[Bohemia]].]]

Actual Results:
The conflicting frame/border or thumb/border options do not trigger a Linter error.

Expected Results:
The conflicting frame/border or thumb/border options should trigger a Linter error.

Event Timeline

Until a minute ago, [[mw:Help:Images]] said "If multiple of these options are present, only the first one will be used".

That was not correct. I have changed it and added a note with a link to this bug report.

See https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox&oldid=981508576 which shows that when border is listed first and thumb or frame is present, thumb or frame overrides border. I have not created test cases for all of the other possible combinations.

See https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox&oldid=1092380847 for a more thorough set of test cases. The border option appears to be ignored when frame or thumb is present.

Perhaps the problem lies only in the documentation. The documentation at Help:Images currently says: "Format option: one of border and/or frameless, frame (or framed), thumb (or thumbnail)." This text is at best confusing. Maybe it should say:

"Format option: border, or one of frameless, frame (or framed), or thumb (or thumbnail). If border is used with one of the other options, border will be ignored."

I think that would match the existing situation, and then this bug report could be closed, unless someone wants to flag all instances of border accompanying one of the other options as a Linter error (which would be pointless, IMHO).

Looking at the code,
https://github.com/wikimedia/mediawiki/blob/master/includes/Linker.php#L470

It seems border wouldn't apply to frame, thumb, or manualthumb. But it would to frameless or no format.

"Format option: border, or one of frameless, frame (or framed), or thumb (or thumbnail). If border is used with one of the other options, border will be ignored."

I would maybe not document border as a format. I would put it somewhere else and say it doesn't apply if the frame, or thumb formats are used. That'll avoid the confusion of this ticket that it's expected to be mutually exclusive.

I think that would match the existing situation, and then this bug report could be closed, unless someone wants to flag all instances of border accompanying one of the other options as a Linter error (which would be pointless, IMHO).

I could do it if you wanted.

Arlolra added a subscriber: Sbailey.

I made a first (and second) pass at improving the above documentation at https://www.mediawiki.org/wiki/Help:Images. If you want to split out border, go for it. I think this bug report can be closed once that is done. Thanks for engaging.

I think what you did is clear enough. There's also an example of "frameless and border" in the table, https://www.mediawiki.org/wiki/Help:Images#Format, which leads me to believe that the intention was to use it in combination with the other formats. I'll just need to check how Parsoid renders all this before closing it out.

Arlolra claimed this task.

I'll just need to check how Parsoid renders all this before closing it out.

Yup, Parsoid has been matching the legacy parser for a while now,
https://github.com/wikimedia/parsoid/commit/a434faaff28af6730c381325771fc3a54921b869

unless someone wants to flag all instances of border accompanying one of the other options as a Linter error (which would be pointless, IMHO).

I could do it if you wanted.

Agreed that it seems like more of a no-op than an error and probably not worth linting at the moment