User:Novem Linguae/Scripts/SpeciesHelper

For species articles, try to add the correct short description, speciesbox, category, taxonbar, and stub template.

Designed for

 * Species articles only
 * Not for higher taxa (genus, family, etc.)
 * Not for viruses

How to use

 * This script adds a "Run SpeciesHelper" link to the left menu. Click that. It will then take you to a diff screen where you can double check everything.
 * You can also run it using the hotkey combination Alt+A. Then use Alt+Shift+S to save the edit.

Features

 * Stub - If the article is 150 words or less of readable prose, will grab the entire taxonomy of the species, then work from the bottom up of that taxonomy until it finds the most specific stub possible. Will skip stubbing in draftspace.
 * Taxonomy category - Will grab the entire taxonomy of the species, then work from the bottom up of that taxonomy until it finds the most specific taxonomy category possible. If it finds a genus category, it will also add the species as a disambiguator, e.g. . In draftspace, will add the category with a colon, e.g.
 * Taxonbar - If a Wikidata ID exists, will add a taxonbar with the correct Wikidata ID.
 * Improve categories - If there is 1 category or less, will add the maintenance tag Improve categories. Since the ideal set of categories for a species article is usually 3 categories: 1 taxonomy category, 1 flora/fauna of country category, and 1 described in X year category.
 * Speciesbox - If no taxobox or speciesbox of any kind is present, will add a Speciesbox
 * Template:Taxonomy - If Template:Taxonomy does not exist for that genus, will alert the user so they can create it.
 * Italic title - Removes unnecessary Italic title templates.
 * Taxobox - If there is a Taxobox or Automatic taxobox, will convert it to Speciesbox
 * Short descriptions - If no short description is present, and the phrase "is a species of" is present in the article, will capture what is after that phrase and add it as a short description, e.g.  will generate.
 * Cleanup - Will clean up some common issues. Will convert to, will convert heading level 1's to heading level 2's, will remove excessive newlines, will remove empty  s, will remove  s identical to the title (case insensitive), and some other small adjustments.

Issues
This script shows a diff of suggested changes for the user to evaluate before saving. Please check this diff carefully. The script is not perfect.
 * Detailed list of known issues.
 * If a category or stub uses a non-latin name instead of a latin name, this can confuse the script. There is a dictionary of non-latin name = latin name equivalents that help improve its accuracy, but it is not 100% comprehensive.
 * If there is a category at the species level, such as Category:Chimpanzees, doesn't currently handle these, resulting in over-categorization.

Planned future features

 * Wikidata - When an exact latin species name match is found in Wikidata, automatically link the two articles.
 * Category:Described in year - Analyze the wikitext for "described in 2015" or similar, and add the appropriate category.

Converting taxoboxes to speciesboxes

 * This is one of the things that SpeciesHelper does automatically.
 * Seems like the current consensus is that it's desirable to convert taxobox to speciesbox in all articles, except for certain gastropods. As such, I have programmed SpeciesHelper to skip conversion for gastropod articles.

Missing Template:Taxonomy


This script depends on some hidden templates that are sub-pages of Template:Taxonomy. Sometimes the script will alert you that Template:Taxonomy/abc is missing and needs to be created.

These templates can be complicated to create, so one way to handle this is to skip these articles.

If you want to take a stab at creating Template:Taxonomy/abc yourself in newer articles, here are some tips.

My other user script, TemplateTaxonomyAddCite, assists with searching databases and adding citation templates.
 * Assume that you want to add a speciesbox to the article "Homo sapien", but SpeciesHelper alerts you that Template:Taxonomy/Homo is missing.
 * Navigate to Template:Taxonomy/Homo and create the article. Make sure to capitalize Homo.
 * Find where it says Thanks for creating this page. Code should already be in the box below. If not, click here to reset. Click on "click here to reset", which will pre-fill the page with the correct template.
 * Fill in |rank= with the correct rank, in latin. Will be "genus" for the first one, then something else if you need to create higher ranked templates above that. List of latin ranks. Use Latin, not English. For example, use tribus, not tribe.
 * Fill in |parent= with the parent taxon. Use a source such as http://www.indexfungorum.org/ for fungi or https://marinespecies.org/ for marine animals to view the species' entire taxonomic tree. You can use this to determine the parent.
 * Fill in |refs= with the website you obtained the information from. Using Cite web is recommended so that you can indicate the |access-date=. Some specialized citation templates exist, such as Cite WoRMS and inaturalist taxon
 * Click save. If a big list of taxa appears as a table on the right side of the page, you're done. If you get a bunch of errors, then you need to add the parent taxon using the same process, until you link your subtree to an existing taxonomy template.