Skip to content

Conversation

@thewtex
Copy link
Member

@thewtex thewtex commented Jan 15, 2026

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

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
@netlify
Copy link

netlify bot commented Jan 15, 2026

Deploy Preview for insightjournal ready!

Name Link
🔨 Latest commit 8f46829
🔍 Latest deploy log https://app.netlify.com/projects/insightjournal/deploys/696aac564601b8000813fb1a
😎 Deploy Preview https://deploy-preview-247--insightjournal.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@thewtex
Copy link
Member Author

thewtex commented Jan 16, 2026

Copy link

Copilot AI left a 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 namePart but the parameter is named name. This will cause a ReferenceError. Change namePart to name in 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>
Copy link
Member

@jhlegarreta jhlegarreta left a 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 🚀 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants