Page MenuHomePhabricator

Gallery does not allow "center" "left" or "right" as a caption for a gallery image
Open, MediumPublic

Description

This was initially reported as a false linter error on T266406 but further debugging revealed that Parsoid and Gallery are "eating" the words left, center or right (which make no sense anyway in the context of a Gallery image). Parsoid and Gallery provides a default halign value of none which when followed with a left, center or right word is parsed as an alignment, instead of passing through. These words get detected early on as an halign values and are consumed - so no longer available as a caption. They are also seen as a duplicate alignment parameter and flagged as a bogus parameter which the linter finds and reports erroneously.
The following wikitext demonstrates the issue:

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

Event Timeline

For clarification, in case people are looking at this without context: Sometimes editors use "Center" as the caption for a gallery image, typically for an image showing the central area of buildings in a municipality. That caption is erroneously hidden by the MediaWiki software. It should be displayed.

Jonesey, this is a bug, and it will be fixed, not put off for years. It was
just more than a Linter bug, which is what I am focussing on, and after
debugging it, I determined that the problem occurs fairly early in the
parsing stages far removed from the Linter and is going to be tricky to
fix. I confirmed with my team mates that we will not deem this an annoying
quirk that we ignore, but fixing it was outside the scope of my current
tasks. I'll keep an eye on this task. Thanks for the additional insight as
to how editors might use Center more often than one might imagine.
Best,
Shannon