Restore Research notes as a real section; keep disclaimer.
Link MII/IPW team codes in research notes.
Line 2: Line 2:
  * Hide leftover imported rows the infobox no longer shows.
  * Hide leftover imported rows the infobox no longer shows.
  * Put the research-notes disclaimer under that section heading.
  * Put the research-notes disclaimer under that section heading.
* Turn MII / IPW / 439-G style codes in notes into team links.
  */
  */
$(function () {
$(function () {
Line 19: Line 20:
if ($heading.length && $disclaimer.length) {
if ($heading.length && $disclaimer.length) {
$disclaimer.insertAfter($heading);
$disclaimer.insertAfter($heading);
}
function teamHref(name) {
return '/index.php?title=' + encodeURIComponent('Team ' + name).replace(/%20/g, '_');
}
function teamLink(name, label) {
return '<a href="' + teamHref(name) + '" title="Team ' + name + '">' + label + '</a>';
}
function linkifyTeams(raw) {
var text = $('<div>').text(raw).html();
text = text.replace(/\bMII\s+(\d{2,4})\s*[-–]?\s*([A-Za-z])\b/gi, function (_, num, letter) {
var name = 'MII ' + num + '-' + letter.toUpperCase();
return teamLink(name, 'MII ' + num + '-' + letter.toUpperCase());
});
text = text.replace(/\bMII\s+(\d{2,4})\b/gi, function (_, num) {
return teamLink('MII ' + num, 'MII ' + num);
});
text = text.replace(/(?<!\bMII\s)\b([4-5]\d{2})\s*[-–]\s*([GIgi])\b/g, function (_, num, letter) {
var name = 'MII ' + num + '-' + letter.toUpperCase();
return teamLink(name, num + '-' + letter.toUpperCase());
});
text = text.replace(/\bIPW\s+(\d{1,4})\b/gi, function (_, num) {
return teamLink('IPW ' + num, 'IPW ' + num);
});
return text;
}
}


Line 32: Line 58:
});
});
if (kept.length) {
if (kept.length) {
$li.text(kept.join('; '));
$li.html(linkifyTeams(kept.join('; ')));
} else {
} else {
$li.remove();
$li.remove();