Fix matching external link rel

Introduced in I8d7bdf1bccc869b4dc17058a5822ef34968471e6

Change-Id: I52a8a993fbdd4058d40f4aeac3df37e90e686f3e
This commit is contained in:
Arlo Breault 2024-02-15 21:15:03 -05:00
parent 760641e180
commit 4d19d19f1d
2 changed files with 16 additions and 1 deletions

View file

@ -207,7 +207,7 @@ class ParsoidImageMap extends ExtensionTagHandler implements ExtensionModule {
DOMUtils::assertElt( $a );
$href = $a->getAttribute( 'href' );
$externLink = DOMUtils::matchRel( $a, '#^mw:ExtLink/#D' ) !== null;
$externLink = DOMUtils::matchRel( $a, '#^mw:ExtLink#D' ) !== null;
$alt = '';
$hasContent = $externLink || ( DOMDataUtils::getDataParsoid( $a )->stx ?? null ) === 'piped';

View file

@ -334,3 +334,18 @@ Foobar.jpg
!! html/parsoid-disabled
<p><span typeof="mw:Extension/imagemap mw:Error" about="#mwt2" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFoobar.jpg\n"},"errors":[{"key":"imagemap_no_image"}]}' data-mw-i18n='{"/":{"lang":"x-user","key":"imagemap_no_image","params":null}}'>imagemap_no_image</span></p>
!! end
!! test
Imagemap with external link
!! config
wgParserEnableLegacyMediaDOM=false
!! wikitext
<imagemap>
File:Foobar.jpg
default [http://google.com]
</imagemap>
!! html/php
<figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File"><a rel="nofollow" href="http://google.com" class="plainlinks" title="http://google.com"><img src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" resource="/wiki/File:Foobar.jpg" /></a><figcaption></figcaption></figure>
!! html/parsoid
<figure class="mw-default-size noresize mw-ext-imagemap-desc-bottom-right" typeof="mw:File mw:Extension/imagemap" data-mw='{"name":"imagemap","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg\ndefault [http://google.com]\n"}}'><a href="http://google.com" class="plainlinks" rel="nofollow"><img resource="./File:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" class="mw-file-element"/></a><figcaption></figcaption></figure>
!! end