Page MenuHomePhabricator

Linter false positive: "Center/Left/Right" as caption for gallery image
Open, Needs TriagePublic

Description

See https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox&oldid=985362785

The words "Center", "Left", or "Right" used as a caption for a gallery image work fine but are detected as a Linter error.

https://www.mediawiki.org/wiki/Help:Images#Rendering_a_gallery_of_images does not contain a workaround like "caption=" or "1=" for gallery image captions.

This is actually a Parsoid/Gallery bug which consumes the captions if they are the words left, center or right and treats them as halign values that are invalid, and also causes erroneous linter errors. See:
https://phabricator.wikimedia.org/T275074
for further details

Event Timeline

Notes: If looks like the use of left, right or center as caption words not only generates linter errors, the captions are not there, as the words have been eaten as options and not allowed to be captions. In looking at this further, the use of left, right or center in gallary seems not to be valid as an option, and so should be allowed as captions. In the following example,

<gallery>
File:Foobar.jpg|left
File:Foobar.jpg|notaleft
</gallery>

produces linter error:

{"type":"bogus-image-options","dsr":[0,66,9,10],"params":{"items":["left"]}}

and renders as:

... class="gallerytext" data-parsoid="{}"></div></li>
... class="gallerytext" data-parsoid='{"dsr":[47,55,0,0]}'>notaleft</div></li>
Sbailey added a subscriber: Sbailey.

I'm not sure if this is the same bug or a different bug, but I just came across something similar with "Frame". This syntax on en.WP renders correctly (the word "Frame" appears as a caption) but generates a Linter false positive error:

[[File:Frame front 30.jpg|right|thumb|100px|Frame]]

Once again, the lack of a caption= option to override this quirk is a problem. I hope that someone is willing to take the time to gather all of these File syntax tasks and sort out ticket T274382.