User:Bility/biographyListasGenerator

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:

  1. If no spaces are in the title, nothing is done
  2. 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".
  3. Anything in parentheses is removed.
    • Ex: "Tim Jones (baseball player)" would become "Tim Jones".
  4. 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".
  5. 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".
  6. 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
  7. 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".

Installation

To install this script, edit your skin javascript or common.js and add the following code:

importScript('User:Bility/biographyListasGenerator.js');

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.