Do not treat category captions as gallery captions

Categories are implemented via galleries, so they have the same
markup, but while galleries have human-written captions, category
captions just contain the file page.

Change-Id: I6a8548fe696418befc789e20b114778fc724c314
This commit is contained in:
Gergő Tisza 2014-07-25 01:40:58 +00:00
parent 8dc5f0c1c5
commit 28a7c1b8a4

View file

@ -201,7 +201,14 @@
$thumbCaption = $thumbContain.find( '.thumbcaption' ).clone();
$thumbCaption.find( '.magnify' ).remove();
if ( !$thumbCaption.length ) { // gallery, maybe
$thumbCaption = $thumbContain.closest( '.gallerybox' ).find( '.gallerytext' ).clone();
$thumbCaption = $thumbContain
.closest( '.gallerybox' )
.not( function () {
// do not treat categories as galleries - the autogenerated caption they have is not helpful
return $thumbContain.closest( '#mw-category-media' ).length;
} )
.find( '.gallerytext' )
.clone();
}
caption = this.htmlUtils.htmlToTextWithLinks( $thumbCaption.html() || '' );