Module:FindYDCportal/doc

A helper module to find the most specific chronology portal which actually exists for a given year or decade. Used to simplify linking to a chronology portal.

All by-year and by-century portals have been deleted. There are now only 8 decade portals, listed in Category:Decades portals.
 * October 2019 update

So all checking for century and year portals has been disabled.

If any of the decade portals are deleted, then this module should be edited to remove that decade from the table existingDecadePortals

Parameters
Takes one parameter, which must be either a year (e.g. "1879", "1123") or a decade (e.g. "1940s", "730s").

If the parameter is missing, empty, or does not fit the required format, an empty string is returned.

Output
If a portal is found, returns its name without the namespace prefix, e.g.
 * for "Portal:1980s" return
 * for "Portal:19th century" return

If no portal is found, it returns an empty string.

Usage
... where  is a 3- or 4-digit year
 * Year parameter

... where  is a 3- or 4-digit decade
 * Decade parameter

Examples

 * Years


 * Decades


 * Missing parameter


 * Empty parameter


 * Invalid parameter

Logic
If the parameter is a year:
 * 1) If the year portal exists, return its name. Otherwise try the decade.
 * 2) If the decade portal exists, return its name. Otherwise try the century
 * 3) If the century portal exists, return its name. Otherwise return an empty string

If the parameter is a decade:
 * 1) If the decade portal exists, return its name. Otherwise try the century
 * 2) If the century portal exists, return its name. Otherwise return an empty string