Page MenuHomePhabricator

Visual editor shouldn't add the File: prefix when missing in a gallery
Open, MediumPublic

Description

<gallery> can be filled with images with the File: prefix, or without it.

When VE opens a page where a gallery has images with no prefixes, it adds prefixes. This bothers people who use wikitext (feedback) because it "complexifies the code".

Would it be possible to have VE not adding the prefixes when they are omitted in the wikitext?

The other solution would be to remove the ability to have galleries displayed without the prefix, to have consistency on how images are displayed.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 13 2018, 4:11 PM

The documentation recommends that the "File:" prefix be used: https://en.wikipedia.org/wiki/Help:Gallery_tag#Syntax. It may be possible for Parsoid to preserve the prefix with, but I think it would just to be consistent everywhere.

I guess it was premature to close T151367 :(

This is probably a VE issue rather than Parsoid issue. See also T207620 (duplicate?).

The documentation recommends that the "File:" prefix be used: https://en.wikipedia.org/wiki/Help:Gallery_tag#Syntax.

A quick note concerning the documentation - please don't quote English Wikipedia but use MediaWiki doc instead. That doc is supposed to be more neutral and up to date (in theory).

This is probably a VE issue rather than Parsoid issue.

If you round-trip gallery syntax without File: prefixes, and remove the wikitext body, the File: prefixes get added back in, so it is a Parsoid issue.

and remove the wikitext body

You can also pass --nativeGallery to avoid emitting that.

https://github.com/wikimedia/parsoid/blob/master/lib/ext/Gallery/index.js#L325-L334

But we should probably consider making that the default now that VE has html editing support for galleries.

JTannerWMF moved this task from To Triage to Freezer on the VisualEditor board.Dec 19 2018, 10:25 PM

Here's a list of pages with gallery normalizations to explore,
https://phabricator.wikimedia.org/P8032

ssastry triaged this task as Medium priority.Jun 10 2019, 8:43 PM
ssastry edited projects, added Parsoid-Edit-Support; removed Parsoid.
Pols12 added a subscriber: Pols12.Jun 23 2019, 11:59 PM
Thibaut120094 renamed this task from VE shouldn't add the File: prefix when missing in a gallery to Visual editor shouldn't add the File: prefix when missing in a gallery.Dec 29 2019, 12:10 PM
Thibaut120094 added a subscriber: Thibaut120094.
Aklapper edited projects, added Parsoid; removed Parsoid-Edit-Support.Feb 29 2020, 5:15 PM

You can also pass --nativeGallery to avoid emitting that.

How can we do this in the API?

You can also pass --nativeGallery to avoid emitting that.

That flag was removed in,
https://github.com/wikimedia/parsoid/commit/e748b8ec831bf6c86487ca8e551274d62be16b1d

How can we do this in the API?

Parsoid defaults to using native galleries now,
https://github.com/wikimedia/parsoid/blob/master/src/Config/SiteConfig.php#L158

However, it's disabled in the extension,
https://github.com/wikimedia/parsoid/blob/master/extension/src/Config/SiteConfig.php#L175

so you'd need to change that hardcoded value.

Unfortunately, we still need the signal from the explicit removal of extsrc when a gallery is edited because of T214648

Arlolra moved this task from Needs Triage to Backlog on the Parsoid board.Mar 2 2020, 4:27 PM
LGoto assigned this task to Arlolra.May 8 2020, 4:28 PM
LGoto moved this task from Backlog to Needs Investigation on the Parsoid board.
Arlolra removed Arlolra as the assignee of this task.May 8 2020, 8:27 PM
Arlolra moved this task from Needs Investigation to Bugs & Crashers on the Parsoid board.