Match output for broken thumbnails
Follow up to the FIXME added in I6d03037af1b5c90e6d57fd048506da2b4e4bc704 The output isn't great but at least it matches Parsoid's. Change-Id: I5660b8ccdb8bd0c89b94669a1c6ab260d57183df
This commit is contained in:
parent
bb1bb4508e
commit
ad0746110c
2 changed files with 9 additions and 5 deletions
|
|
@ -714,8 +714,13 @@ class Linker {
|
|||
);
|
||||
$zoomIcon = '';
|
||||
} elseif ( !$thumb ) {
|
||||
// FIXME(T169975): Add "mw:Error"?
|
||||
$s .= wfMessage( 'thumbnail_error', '' )->escaped();
|
||||
if ( $enableLegacyMediaDOM ) {
|
||||
$s .= wfMessage( 'thumbnail_error', '' )->escaped();
|
||||
} else {
|
||||
$s .= self::makeBrokenImageLinkObj(
|
||||
$title, '', '', '', '', (bool)$time, $handlerParams
|
||||
);
|
||||
}
|
||||
$zoomIcon = '';
|
||||
} else {
|
||||
if ( !$noscale && !$manualthumb ) {
|
||||
|
|
@ -768,7 +773,7 @@ class Linker {
|
|||
$rdfaType = 'mw:Image' . $rdfaType;
|
||||
}
|
||||
|
||||
if ( !$exists ) {
|
||||
if ( !$exists || !$thumb ) {
|
||||
$rdfaType = 'mw:Error ' . $rdfaType;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2261,7 +2261,6 @@ wgParserEnableLegacyMediaDOM=false
|
|||
<p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg" class="new">Image:No such.jpg</a></p>
|
||||
!! end
|
||||
|
||||
## FIXME: The legacy parser output doesn't match Parsoid here
|
||||
!! test
|
||||
Fuzz testing: image with bogus manual thumbnail
|
||||
!! config
|
||||
|
|
@ -2269,7 +2268,7 @@ wgParserEnableLegacyMediaDOM=false
|
|||
!! wikitext
|
||||
[[Image:foobar.jpg|thumbnail= ]]
|
||||
!! html/php
|
||||
<figure class="mw-default-size" typeof="mw:Image/Thumb">Error creating thumbnail: <figcaption></figcaption></figure>
|
||||
<figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb"><a href="/index.php?title=Special:Upload&wpDestFile=Foobar.jpg" class="new" title="File:Foobar.jpg"><span data-width="180">File:Foobar.jpg</span></a><figcaption></figcaption></figure>
|
||||
!! html/parsoid
|
||||
<figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"attribs":[["manualthumb",{"txt":""}]],"errors":[{"key":"apierror-invalidtitle","message":"Invalid thumbnail title.","params":{"name":""}}]}'><a href="./Special:FilePath/Foobar.jpg"><span resource="./File:Foobar.jpg" data-parsoid='{"a":{"resource":"./File:Foobar.jpg"},"sa":{"resource":"Image:foobar.jpg"}}'>File:Foobar.jpg</span></a><figcaption></figcaption></figure>
|
||||
!! end
|
||||
|
|
|
|||
Loading…
Reference in a new issue