Skip to content

Commit

Permalink
Docs: Normalize acknowledgement names.
Browse files Browse the repository at this point in the history
  • Loading branch information
kitschpatrol committed Dec 7, 2023
1 parent 48aca7d commit ae1578a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/src/components/docs/Acknowledgments.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ function titleCase(text: string) {
.join(' ');
}
function stripQuotes(text: string) {
return text.replace(/^["']|["']$/g, '');
}
function getNameFromEmail(name: string) {
if (name.includes('@')) {
return name.split('@')[0].replace(/[_-]/g, ' ');
Expand Down Expand Up @@ -47,7 +51,7 @@ const names = data
if (author) {
// Split compound comma-delimited publishers as needed
for (const subItem of author.split(/\s*(?:\sand\s|,|&)\s*/)) {
const subPublisher = titleCase(getNameFromEmail(subItem.trim()));
const subPublisher = titleCase(stripQuotes(getNameFromEmail(subItem.trim())));
if (subPublisher && !accumulator.includes(subPublisher)) {
accumulator.push(subPublisher);
}
Expand Down

0 comments on commit ae1578a

Please sign in to comment.