-
Notifications
You must be signed in to change notification settings - Fork 6
style(Authors): format as "First Last" #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
style(Authors): format as "First Last" #247
Conversation
Address InsightSoftwareConsortium#179 Updated the Authors.astro component with: Added capitalizeNamePart() helper - Ensures proper capitalization (first letter uppercase, rest lowercase) Added formatAuthorName() helper - Intelligently converts "Last, First" format to "First Last": - Detects the comma separator - Splits on comma - Reverses the order - Applies proper capitalization to each part - Falls back to simple capitalization for non-comma names - Updated getAuthorName() function - Now uses the new formatting logic for all name types: - Structured name objects (given/family) - String names - Literal name objects
✅ Deploy Preview for insightjournal ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@jhlegarreta what do you think of this: https://deploy-preview-247--insightjournal.netlify.app/browse/publication/301/ ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the Authors.astro component to improve author name formatting by adding intelligence to handle "Last, First" name format and ensure proper capitalization. The changes introduce helper functions to automatically convert comma-separated names and normalize capitalization across different name formats.
Changes:
- Added
capitalizeNamePart()helper to enforce consistent capitalization (first letter uppercase, rest lowercase) - Added
formatAuthorName()helper to intelligently convert "Last, First" format to "First Last" and apply proper capitalization - Updated
getAuthorName()to use new formatting logic for all name types (structured, string, and literal)
Comments suppressed due to low confidence (1)
src/components/Authors.astro:1
- The function checks for
namePartbut the parameter is namedname. This will cause a ReferenceError. ChangenameParttonamein both occurrences on line 30.
---
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The capitalizeNamePart() function unconditionally lowercases all characters after the first letter, which could incorrectly format names with special capitalization patterns such as 'McDonald', 'O'Brien', 'van der Waals', or 'McPherson'. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jhlegarreta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, Matt 🚀 !
Address #179
Updated the Authors.astro component with:
Added capitalizeNamePart() helper - Ensures proper capitalization (first letter uppercase, rest lowercase)
Added formatAuthorName() helper - Intelligently converts "Last, First" format to "First Last":
Detects the comma separator
Splits on comma
Reverses the order
Applies proper capitalization to each part
Falls back to simple capitalization for non-comma names
Updated getAuthorName() function - Now uses the new formatting logic for all name types:
Structured name objects (given/family)
String names
Literal name objects