Documentation
¶
Overview ¶
Package sortname provides functions for generating bibliographic sort names following ALA/Library of Congress conventions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AcademicSuffixes = []string{
"PhD",
"Ph.D",
"Ph.D.",
"PsyD",
"Psy.D",
"Psy.D.",
"MD",
"M.D",
"M.D.",
"DO",
"D.O",
"D.O.",
"DDS",
"D.D.S",
"D.D.S.",
"JD",
"J.D",
"J.D.",
"EdD",
"Ed.D",
"Ed.D.",
"LLD",
"LL.D",
"LL.D.",
"MBA",
"M.B.A",
"M.B.A.",
"MS",
"M.S",
"M.S.",
"MA",
"M.A",
"M.A.",
"BA",
"B.A",
"B.A.",
"BS",
"B.S",
"B.S.",
"RN",
"R.N",
"R.N.",
"Esq",
"Esq.",
}
AcademicSuffixes are stripped from the sort name as they are credentials, not part of the name.
var GenerationalSuffixes = []string{
"Jr.",
"Jr",
"Sr.",
"Sr",
"Junior",
"Senior",
"I",
"II",
"III",
"IV",
"V",
}
GenerationalSuffixes are preserved in the sort name as they distinguish different people.
var Particles = []string{
"van",
"von",
"de",
"da",
"di",
"du",
"del",
"della",
"la",
"le",
"el",
"al",
"bin",
"ibn",
}
Particles are name particles that are moved to the end with the given name (library style). Example: "Ludwig van Beethoven" -> "Beethoven, Ludwig van".
var Prefixes = []string{
"Dr.",
"Dr",
"Mr.",
"Mr",
"Mrs.",
"Mrs",
"Ms.",
"Ms",
"Prof.",
"Prof",
"Rev.",
"Rev",
"Fr.",
"Fr",
"Sir",
"Dame",
"Lord",
"Lady",
}
Prefixes are honorifics/titles that are stripped from the sort name.
var TitleArticles = []string{
"The",
"A",
"An",
}
TitleArticles are articles to strip from the beginning of titles. These are moved to the end (e.g., "The Hobbit" -> "Hobbit, The").
Functions ¶
func ForPerson ¶
ForPerson generates a sort name from a person's display name. The name is converted to "Last, First Middle" format with proper handling of:
- Prefixes (Dr., Mr., etc.) - stripped
- Academic suffixes (PhD, MD, etc.) - stripped
- Generational suffixes (Jr., III, etc.) - preserved
- Particles (van, von, de, etc.) - moved to end with given name
Examples:
- "Stephen King" -> "King, Stephen"
- "Martin Luther King Jr." -> "King, Martin Luther, Jr."
- "Jane Doe PhD" -> "Doe, Jane"
- "Dr. Sarah Connor" -> "Connor, Sarah"
- "Ludwig van Beethoven" -> "Beethoven, Ludwig van"
func ForTitle ¶
ForTitle generates a sort title from a display title. Leading articles are moved to the end. Examples:
- "The Hobbit" -> "Hobbit, The"
- "A Tale of Two Cities" -> "Tale of Two Cities, A"
- "An American Tragedy" -> "American Tragedy, An"
- "Lord of the Rings" -> "Lord of the Rings" (no change)
Types ¶
This section is empty.