From dadba1577a274e9d3e9c1e7e1c0ece5216a3ca5e Mon Sep 17 00:00:00 2001 From: Simone Bortolin Date: Sat, 24 Dec 2022 15:38:57 +0100 Subject: update script --- _layouts/default.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index 15482bb..ee4050c 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -247,8 +247,11 @@ layout: table_wrappers } }); } + function parseCoAuthor(commitMessage) { + return commitMessage.split('\n')?.filter(line => line.startsWith('Co-authored-by:')).map(line => line.replace('Co-authored-by:','').replace('\r','').trim()).map(line => line.split("<").map(it => it.slice(0, -1))).map(([name, email]) => ({name, email})); + } async function parseCommitsList(commits, filename) { - var authors = commits.flatMap(x => [{ ...x.commit.author, ...x.author }, { ...x.commit.committer, ...x.committer }]).map(({ date, ...keepAttrs }) => keepAttrs).filter((value, index, self) => + var authors = commits.flatMap(x => [{ ...x.commit.author, ...x.author }, { ...x.commit.committer, ...x.committer }].concat(parseCoAuthor(x.commit.message))).map(({ date, ...keepAttrs }) => keepAttrs).filter((value, index, self) => index === self.findIndex((t) => ( t.login === value.login )) && value.login !== "web-flow" @@ -283,8 +286,9 @@ layout: table_wrappers document.getElementById('last-modified').textContent = "Last Modified: " + modified; document.getElementById('contributors').textContent = authors.length + " " + (authors.length == 1 ? "Contributor" : "Contributors"); - document.getElementById('contributors-modal-list').innerHTML = authors.map(x => "
  • " + x.name + "
  • ").join(''); + document.getElementById('contributors-modal-list').innerHTML = authors.map(x => "
  • " + x.name + "
  • ").join(''); } catch (err) { + console.log(err); document.getElementById('last-modified').textContent = "Sorry, last modified not currently available"; document.getElementById('contributors').textContent = "Contributors"; document.getElementById('contributors-modal-list').innerHTML = "
  • Sorry, list not currently available
  • "; -- cgit v1.2.3