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.
This commit is contained in:
parent
64a85b6aab
commit
08ca2a2db3
@ -24,10 +24,12 @@ public class ContributorDto : IFormattable
|
|||||||
|
|
||||||
//Single-word names parse as first names. Use it as last name.
|
//Single-word names parse as first names. Use it as last name.
|
||||||
var lastName = string.IsNullOrWhiteSpace(HumanName.Last) ? HumanName.First : HumanName.Last;
|
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
|
return format
|
||||||
.Replace("{T}", HumanName.Title)
|
.Replace("{T}", HumanName.Title)
|
||||||
.Replace("{F}", HumanName.First)
|
.Replace("{F}", firstName)
|
||||||
.Replace("{M}", HumanName.Middle)
|
.Replace("{M}", HumanName.Middle)
|
||||||
.Replace("{L}", lastName)
|
.Replace("{L}", lastName)
|
||||||
.Replace("{S}", HumanName.Suffix)
|
.Replace("{S}", HumanName.Suffix)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user