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.