- Code for this script resides at User:Bility/biographyListasGenerator.js
This script populates the |listas=
parameter of {{WikiProject Biography}}
with a suggested sort name based on the article's title. The script only executes when editing a mainspace (article) talk page. The scripts adds a button above the edit tool box (
) that attempts to insert the sort name when you click it.
- Requirements
You must be in edit mode on a mainspace talk page and the WikiProject Biography or WPBiography templates must be in the page's wikitext. Additionally, the template must already contain the |listas=
parameter.
- Suggestion rules
The script goes through a series if instructions to return a sort name:
- If no spaces are in the title, nothing is done
- If the article starts with "List of", whatever comes after "List of" is returned, with the first letter capitalized.
- Ex: "List of brown-haired poodle trainers" would become "Brown-haired poodle trainers".
- Anything in parentheses is removed.
- Ex: "Tim Jones (baseball player)" would become "Tim Jones".
- If a comma exists, only text to the left of the comma is considered.
- Ex: "Tim Jones, player of the millenium" would become "Tim Jones".
- Article names in the form of "[text] of [text]" only consider the "[text]" to the left of the word "of".
- Ex: "Tim Jones of Madagascar" would become "Tim Jones".
- If a Nobiliary particle is detected, it and whatever follows it becomes the last name and whatever precedes it becomes the first name.
- Ex: "Tim von Jones" would become "von Jones, Tim".
- Current list of particles: de, von, du, del, zu, di, van, na
- If there is no nobiliary particle, the word following the last space becomes the last name and whatever precedes it becomes the first name.
- Ex: "Tim Jones" would become "Jones, Tim" and "Tim Zacharias Jones" would become "Jones, Tim Zacharias".