User:Novem Linguae/Scripts/DraftCleaner.js: Difference between revisions

Content deleted Content added
handle edge case in refShortLinkToLongLink() (publish.php)
pass more unit tests (publish.php)
Line 588:
fixExternalLinksToWikipediaArticles(wikicode) {
// [https://en.wikipedia.org/wiki/Article] and [https://en.wikipedia.org/wiki/Article Article name]
return wikicode.replace(/(?<!\[)\[https?:\/\/en\.wikipedia\.org\/wiki\/([^ \]]*)( [^\]]*)?\]/gs, '[[$1]]'function(match, p1); {
p1 = decodeURIComponent(p1);
p1 = p1.replace(/_/g, ' ');
return `[[${p1}]]`;
});
}