I was slowly making my way through the Markdown and DocBook file processing when I hit an interesting snag: names.

Author names are a strange thing. It would be easy to just stick with the Western approach, which is what Amazon uses in their KDP program: first and last name. Smashwords does the same but they add suffix. No mention of title, which some people really hang up on (I almost went through a Ph.D. program just so I could be Dr. Moonfire).

Complexity of names

The problem is that I work with Japanese people who have family name first and given name second. There are others too, I just happen to know Japanese culture a little better than most others. Most websites I know don't actually handle this because they assume the first/last name approach.

You have some cultures where many people have two last names, one from the mother and one from the father.

The other interesting problem comes in with single name authors, let's go with Madonna or Teller for examples. Some websites allow you to go without both names, but there are a lot that don't. Google, for example, insists on something and NFN (No First Name) looks horrible when they say "Hello, NFN!".

An interesting one is Goodreads. Goodreads lets you have an account with only one name, but you can't sign up for a raffle without both names filled out.

There are also names that start with a lowercase character or have an apostrophe in the middle. Or a slew of other Unicode characters that most developers make assumptions that aren't true.

This bothers me, but that shouldn't be a surprise. One of the principals of Author Intrusion is "Author Know Best". It means that the author knows what they are doing and we don't tell them how to work. This includes how format their own name. If they want a Unicode symbol, that's fine. I'll probably draw the line at images for authors, simply because I don't want to code that. I'm all for it, it's just low in my priority list.

Solving the problem

Normally, I use DocBook for inspiration on handling things. I figured after so many decades, they've solved most of the problems. And, in this case, I think they have.

<author>
  <personname>Madonna</personname>
</author>
<author>
  <personname>
    <honorific>Not-Dr</honorific>
    <firstname>Dylan</firstname>
    <othername role="middle">Robert Evans</othername>
    <surname>Moonfire</surname>
  </personname>
</author>

There are no specific conventions for othername, but it's better than most. It also lets me enter full names for the author and figure out how to format them later.

In my Markdown files, my author tag is usually a preferred name.

---
Title: Amazon Piece
Author: D. Moonfire
---

It was a dark and stormy tea cup...

This caused me some trouble with formatting ebooks because I occasionally need to know first name and last name to figure out sorting.

Reusing concepts

While I was in the process of figuring out names, I realized that I'm going to have the same problem with one of my future plans: characters. One of the reasons I'm writing this is to highlight character names. All of them, including possessives and nicknames. There is some other ideas around this, but I needed to handle a highly flexible approach there also.

From there, it was easy to figure out that I'm going to use the same class to represent an author name as well as character (location, objects, etc) names. And then I came up with NameInfo. This is a Dictionary<string, string> that uses interned key strings.

NameInfo name = new NameInfo();
name.PreferredName = "Shimusogo Rutejìmo";
// or name["Preferred Name"] = "Shimusogo Rutejìmo";
name["First Name"] = "Rutejìmo";
// or name.FirstName = "Rutejì";
name["Clan"] = "Shimusìgo;
name["Surname"] = "Shimusogo;
name["Nickname"] = "Jìmo";
name["Possessive"] = "Rutejìmo's";
name["Possessive Nickname"] = "Jìmo's";

NameInfo author = new NameInfo() { PreferredName = "D. Moonfire" };

When I write these out in DocBook, it will become a full XML block.

<personname>
    <firstname>Rutejìmo</firstname>
    <surname>Shimusogo</surname>
    <othername role="Clan">Shimusì/othername>
    <othername role="Preferred Name">Shimusogo Rutejìmo</othername>
    <othername role="Nickname">Jìmo</othername>
    <othername role="Possessive">Rutejìmo's</othername>
    <othername role="Possessive Nickname">Jìmo's</othername>
</personname>

<personname>D. Moonfire</personname>

In the Markdown formatter, I get this:

---
name:
  PreferredName: "Shimusogo Rutejìmo"
  FirstName: "Rutejìmo"
  Clan: "Shimusìgo"
  Surname: "Shimusogo"
  Nickname: "Jìmo"
  Possessive: "Rutejìmo's"
  PossessiveNickname: "Jìmo's"
author: D. Moonfire
---

Conclusion

Overall, this seems to work. If you have a simple name, as some authors do, it will create a neat output file and they just have to enter the name. For those who are a bit pickier about names, it will let them have a complex name or set of names. It also means that when I put in name highlighting and refactoring (I rename characters a lot, but I want to also change possessive and nicknames at the same time), I'll have the infrastructure to do so.

2014-08-07