Jump to content

Talk:Astana Indoor Meeting

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Code to generate meeting records

[edit]

The code I used to generate the meeting records table:

evts = [];
[...document.querySelectorAll('figure')].flatMap(fig => {
  const evt = fig.previousElementSibling.innerText.replace(/ ((final|heats?|a,?|b,?|c,?) ?)+$/ig, '');
  if (evts.includes(evt)) return [];
  evts.push(evt);
  const tds = [...fig.querySelector('tbody tr').querySelectorAll('td')].map(td => td.innerText);
  const lastName = tds[1].split(' ').at(-1);
  const firstName = tds[1].split(' ').slice(0, -1).join(' ');
  const name = firstName + ' ' + lastName[0] + lastName.slice(1).toLowerCase();
  return `| ${evt} || ${tds[3]} || [[${name}]] || {{flagg|cncie|${tds[2]}}} || {{dts|abbr=on|23 Jan 2024|format=dmy}} || <ref name="wa2023" />`;
}).join('\n|-\n');

--Habst (talk) 00:10, 26 October 2023 (UTC)[reply]