Page MenuHomePhabricator

Linter false positive: "Center/Left/Right" as caption for gallery image
Closed, ResolvedPublic

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 subscribed.

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.

Change 714145 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/services/parsoid@master] [WIP] Make magic words case-sensitive

https://gerrit.wikimedia.org/r/714145

Change 714145 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Make magic words case-sensitive

https://gerrit.wikimedia.org/r/714145

Arlolra claimed this task.
Arlolra subscribed.

However, this is only for the capitalized version of the captions. Leaving T275074 open for the lowercase.

Change 715581 had a related patch set uploaded (by Sbailey; author: Sbailey):

[mediawiki/vendor@master] Bump parsoid to 0.14.0.a17

https://gerrit.wikimedia.org/r/715581

Change 715581 merged by jenkins-bot:

[mediawiki/vendor@master] Bump parsoid to 0.14.0-a17

https://gerrit.wikimedia.org/r/715581