Template:FindYDCportal/doc

From blackwiki
< Template:FindYDCportal
Revision as of 23:17, 22 November 2018 by imported>BrownHairedGirl (Created page with '{{Documentation subpage}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see Wikipedia:Wikidata) --> A h...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A helper template to find the most specific chronology portal for a given year

It is a wrapper template around Module:FindYDCportal. For use within templates, it is most efficient to invoke the module directly. For one-off use, the template requires less typing and makes the co easier to read.

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.

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

Usage

{{FindYDCportal|YYYY}}

Examples

Years
  • {{FindYDCportal|2018}}
  • {{FindYDCportal|1935}}
  • {{FindYDCportal|1857}}
  • {{FindYDCportal|736}}
  • {{FindYDCportal|1800}}
Decades
  • {{FindYDCportal|2000s}}
  • {{FindYDCportal|1940s}}
  • {{FindYDCportal|560s}}
Missing parameter
  • {{FindYDCportal}}
Empty parameter
  • {{FindYDCportal|}}
Invalid parameter
  • {{FindYDCportal|1927-related}}
  • {{FindYDCportal|Swedish chef}}

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

See also