pygments.links.js: Handle empty wikilinks and pipe trick

Skip empty wikilink `[[]]` and reverse pipe trick `[[|foo]]` where valid
and correct title cannot be generated respectively.

Bug: T368166
Change-Id: I5df409c8aa104d93a62cd5c0dbd671d598b7c79e
This commit is contained in:
Ammarpad 2024-10-11 17:50:32 +01:00
parent 73f8f3ef71
commit fea9546eb1

View file

@ -33,7 +33,7 @@ $( () => {
link.href = url;
linkText = URLMatch[ 0 ]; // Preserve visual link text as is
} else if ( wikilinkMatch ) {
} else if ( wikilinkMatch && wikilinkMatch[ 1 ] ) {
linkText = wikilinkMatch[ 0 ];
title = mw.Title.newFromText( wikilinkMatch[ 1 ] );
} else if ( templateMatch ) {