From 08ca2a2db380ab8717a451e3f750a489ffd8eb7d Mon Sep 17 00:00:00 2001 From: Steven Wallace <792372+cherez@users.noreply.github.com> Date: Mon, 5 May 2025 10:37:28 -0500 Subject: [PATCH 1/2] Fixed doubled first name in templates v12.3.0 caused a regression with contributors with a single word name, causing the name to be doubled. This was caused by using that name as both the first and last name, so swap the first name with the (blank) last name rather than duplicate them. --- Source/LibationFileManager/Templates/ContributorDto.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/LibationFileManager/Templates/ContributorDto.cs b/Source/LibationFileManager/Templates/ContributorDto.cs index e52d26d8..593c7950 100644 --- a/Source/LibationFileManager/Templates/ContributorDto.cs +++ b/Source/LibationFileManager/Templates/ContributorDto.cs @@ -24,10 +24,12 @@ public class ContributorDto : IFormattable //Single-word names parse as first names. Use it as last name. var lastName = string.IsNullOrWhiteSpace(HumanName.Last) ? HumanName.First : HumanName.Last; + //Because of the above, if the have only a first name, then we'd double the name as "FirstName FirstName", so clear the first name in that situation. + var firstName = string.IsNullOrWhiteSpace(HumanName.Last) ? HumanName.Last : HumanName.First; return format .Replace("{T}", HumanName.Title) - .Replace("{F}", HumanName.First) + .Replace("{F}", firstName) .Replace("{M}", HumanName.Middle) .Replace("{L}", lastName) .Replace("{S}", HumanName.Suffix) From 7805a3ef1137cca8718d39d2af9dc14daaaad08f Mon Sep 17 00:00:00 2001 From: Steven Wallace <792372+cherez@users.noreply.github.com> Date: Tue, 6 May 2025 09:58:09 -0500 Subject: [PATCH 2/2] Fixed broken single word name test This expected the name duplication that the previous commit fixed to be the behavior, changed to expect the single word to be the last name. --- Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs b/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs index dc68bad6..282a8354 100644 --- a/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs +++ b/Source/_Tests/LibationFileManager.Tests/TemplatesTests.cs @@ -284,7 +284,7 @@ namespace TemplatesTests [DataRow("Carla Naumburg PhD", "Title=, First=Carla, Middle= Last=Naumburg, Suffix=PhD")] [DataRow("Doug Stanhope and Friends", "Title=, First=Doug, Middle= Last=Stanhope and Friends, Suffix=")] [DataRow("Tamara Lovatt-Smith", "Title=, First=Tamara, Middle= Last=Lovatt-Smith, Suffix=")] - [DataRow("Common", "Title=, First=Common, Middle= Last=Common, Suffix=")] + [DataRow("Common", "Title=, First=, Middle= Last=Common, Suffix=")] [DataRow("Doug Tisdale Jr.", "Title=, First=Doug, Middle= Last=Tisdale, Suffix=Jr")] [DataRow("Robert S. Mueller III", "Title=, First=Robert, Middle=S. Last=Mueller, Suffix=III")] [DataRow("Frank T Vertosick Jr. MD", "Title=, First=Frank, Middle=T Last=Vertosick, Suffix=Jr. MD")]