Skip to content

Commit

Permalink
Fix CI build for authors without email.
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Nov 23, 2021
1 parent cde15f6 commit 9863a80
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ handlebars.registerHelper('getAuthors', function (Authors) {
return Authors.split(',').map(author => {
const [_, name, link] = author.trim().match(/^([^<]+)<?([^>]+)?>?$/) || []
let type = 'url'
if (link.match(/^[^@]+@[^@]+$/)) {
type = 'email'
if (link === undefined) {
type = 'github'
} else {
if (link.match(/^[^@]+@[^@]+$/)) {
type = 'email'
}
}
const authorLink = type === 'email' ? 'mailto:' + link : link

const authorLink = type === 'email' ? 'mailto:' + link
: (type === 'github' ? 'https://github.com/' + name
: link)
const authorName = name.trim()

return ' ' + '<a href="' + authorLink + '" alt="' + authorLink + '">' + authorName + '</a>'
Expand Down

0 comments on commit 9863a80

Please sign in to comment.