Gallery output for missing images is not consistent with PHP parser and is missing data
Closed, ResolvedPublic

Description

<gallery>
File:Image_Not_Found.jpg
</gallery>

In PHP this generates a span containing Image Not Found.jpg whereas in Parsoid it generates File:Image_Not_Found.jpg

Including the namespace prefix is consistent with image syntax, so if we want to change the gallery output in this way I wouldn't complain, but you could also argue that in a gallery context the prefix is not necessary. Either way the title should be normalised to remove underscores for readability and word-wrapping issues.

Esanders created this task.Jun 30 2017, 2:44 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 30 2017, 2:44 PM

Also how is one supposed to access the image resource from the DOM in this case? Also the alt text is missing...

<li class="gallerybox" style="width: 155px;">
  <div class="thumb" style="width: 150px; height: 150px;">
    <span style="display: inline-block; height: 100%; vertical-align: middle;"></span>
    <span style="vertical-align: middle; display: inline-block;">File:Image_Not_Found.jpg</span>
  </div>
  <div class="gallerytext"></div>
</li>
Esanders renamed this task from Gallery output for missing images is not consistent with PHP parser to Gallery output for missing images is not consistent with PHP parser and is missing data.Jun 30 2017, 4:43 PM
Arlolra claimed this task.Jul 4 2017, 2:00 AM
Arlolra triaged this task as Normal priority.Jul 5 2017, 4:55 PM
Arlolra raised the priority of this task from Normal to Normal.

Change 363654 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] [WIP] T169342: Make gallery output for missing images consistent with php

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

Also how is one supposed to access the image resource from the DOM in this case?

See L277 here, https://gerrit.wikimedia.org/r/#/c/363654/2/lib/ext/Gallery/index.js where the assumption is that if a .thumb element renders without media, then it's the textContent.

But maybe it's preferable to not suppress the mw:Error?

<span typeof="mw:Error mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Image_Not_Found.jpg"><img resource="./File:Image_Not_Found.jpg" src="./Special:FilePath/Image_Not_Found.jpg" height="120" width="120"/></a></span>

Though that's more of a divergence from php.

Also the alt text is missing...

I take it you mean,

<gallery>
File:Image_Not_Found.jpg|alt=123123
</gallery>

The latter option is perhaps better in this case,

<span typeof="mw:Error mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Image_Not_Found.jpg"><img alt="123123" resource="./File:Image_Not_Found.jpg" src="./Special:FilePath/Image_Not_Found.jpg" height="120" width="120"/></a></span>

The same is true of |link=haha.com,

<span typeof="mw:Error mw:Image" style="vertical-align: middle; display: inline-block;"><a href="http://haha.com"><img alt="123123" resource="./File:Image_Not_Found.jpg" src="./Special:FilePath/Image_Not_Found.jpg" height="120" width="120"/></a></span>

Yes - I suppose plain images already diverge from PHP in this way already (rendering a missing image instead of text).

For the time being it would hurt to be the same as the normal image handler, but we should re-consider this behaviour before switching read mode to Parsoid, as rendering a missing image tag does not convey the same information as saying "this image does not exist (or has been deleted)": a missing image tag could just be an intermittent network error.

Change 363654 merged by jenkins-bot:
[mediawiki/services/parsoid@master] T169342: Render missing gallery images the same as plain

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

Arlolra closed this task as Resolved.Thu, Aug 24, 6:35 PM

Mentioned in SAL (#wikimedia-operations) [2017-09-06T20:34:14Z] <arlolra> Updated Parsoid to f9d367ea (T169342)