diff options
author | Simone Bortolin <simonebortolin@users.noreply.github.com> | 2022-12-24 15:38:57 +0100 |
---|---|---|
committer | Simone Bortolin <simonebortolin@users.noreply.github.com> | 2022-12-24 15:38:57 +0100 |
commit | dadba1577a274e9d3e9c1e7e1c0ece5216a3ca5e (patch) | |
tree | f9bb35a8f57a91f118633f48957289d0c0da8821 | |
parent | minor fix on markdown (#64) (diff) | |
download | hack-gpon.github.io-dadba1577a274e9d3e9c1e7e1c0ece5216a3ca5e.tar hack-gpon.github.io-dadba1577a274e9d3e9c1e7e1c0ece5216a3ca5e.tar.gz hack-gpon.github.io-dadba1577a274e9d3e9c1e7e1c0ece5216a3ca5e.tar.bz2 hack-gpon.github.io-dadba1577a274e9d3e9c1e7e1c0ece5216a3ca5e.tar.lz hack-gpon.github.io-dadba1577a274e9d3e9c1e7e1c0ece5216a3ca5e.tar.xz hack-gpon.github.io-dadba1577a274e9d3e9c1e7e1c0ece5216a3ca5e.tar.zst hack-gpon.github.io-dadba1577a274e9d3e9c1e7e1c0ece5216a3ca5e.zip |
-rw-r--r-- | _layouts/default.html | 8 |
1 files 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 => "<li><a href='" + x.html_url + "'><img class='avatar' src='" + x.avatar_url + "'><span>" + x.name + "</span<</a></li>").join(''); + document.getElementById('contributors-modal-list').innerHTML = authors.map(x => "<li><a href='" + x.html_url + "'><img class='avatar' src='" + (x.avatar_url ?? '/assets/vector/ont-found.png') + "'><span>" + x.name + "</span<</a></li>").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 = "<li>Sorry, list not currently available</li>"; |