Difference between revisions of "Template:Century name from decade or year/doc"
Jump to navigation
Jump to search
imported>Trialpears m (Removing unnecessary Template:Intricate template per Template talk:Intricate template#Change to editnotice? (via WP:JWB)) |
imported>BrownHairedGirl ({{Intricate template}}) |
||
| Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> | <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> | ||
| + | {{Intricate template}} | ||
{{High use|49377 }} | {{High use|49377 }} | ||
When supplied with a 1-, 2-, 3- or 4-digit year or decade, returns the name of the century. | When supplied with a 1-, 2-, 3- or 4-digit year or decade, returns the name of the century. | ||
Revision as of 08:00, 12 August 2020
| 40px | This is a documentation subpage for Template:Century name from decade or year. It contains usage information, categories and other content that is not part of the original template page. |
| 40x40px | This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages. You can conduct experiments, and should test all major changes, in either this template's sandbox, the general template sandbox, or your user space before changing anything here. |
| 40px | This template is used on approximately 65,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
Transclusion count updated automatically (see documentation). |
When supplied with a 1-, 2-, 3- or 4-digit year or decade, returns the name of the century.
Mostly used in categorisation.
Parameters
- The first parameter is required: either a 1-, 2-, 3-, or 4-digit year (e.g. 61, 905, 1839) or a 2-, 3-, or 4--digit decade (e.g. 60s, 900s, 1830s)
- The second parameter is optional. The single word "dash" changes the output from "nth century" to "nth-century"
- An optional "nomatch" parameter may be used to specify text to be return if the input cannot be processed. Default behaviour is return an empty string if there is no match
Usage
{{Century name from decade or year|YYYY}}{{Century name from decade or year|YYYY|dash}}{{Century name from decade or year|YYY0s}}{{Century name from decade or year|YYY0s|dash}}{{Century name from decade or year|YYYY|nomatch=FAIL}}{{Century name from decade or year|YYYY|dash|nomatch=FAIL}}{{Century name from decade or year|YYY0s|nomatch=FAIL}}{{Century name from decade or year|YYY0s|dash|nomatch=FAIL}}
Examples
{{Century name from decade or year|8}}→ Template:Ordinal century{{Century name from decade or year|63}}→ Template:Ordinal century{{Century name from decade or year|421}}→ Template:Ordinal century{{Century name from decade or year|1707}}→ Template:Ordinal century{{Century name from decade or year|1514|dash}}→ Template:Ordinal-century{{Century name from decade or year|0s}}→ Template:Ordinal century{{Century name from decade or year|40s}}→ Template:Ordinal century{{Century name from decade or year|550s}}→ Template:Ordinal century{{Century name from decade or year|1920s}}→ Template:Ordinal century{{Century name from decade or year|2030s|dash}}→ Template:Ordinal-century
Errors
Empty or inappropriate parameters produce no output, unless the "nomatch" paremeter is set.
{{Century name from decade or year}}→{{Century name from decade or year|7}}→ Template:Ordinal century{{Century name from decade or year|123abc}}→{{Century name from decade or year|French flying flamingoes flounce furiously}}→
With "nomatch"
{{Century name from decade or year|nomatch=FAILED}}→ FAILED{{Century name from decade or year|7|nomatch=Aaaaaaaaaargh}}→ Template:Ordinal century{{Century name from decade or year|123abc|nomatch=garbage input}}→ garbage input{{Century name from decade or year|Fastidious French flying flamingoes flounce furiously|nomatch=NOMATCH}}→ NOMATCH
TemplateData
This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.
TemplateData for Century name from decade or year
Returns the name of the century for a 1-, 2-, 3- or 4-digit year or decade.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Year or decade | 1 | a 1-, 2-, 3- or 4-digit-year (e.g. '1957') or a 4-digit-decade (e.g. '1760s')
| Number | optional |
| dash | 2 | If this parameter is dash, then the century number is followed by a dash rather than a space, i.e. '16th-century' instead of the default '16th century'
| String | optional |
| No match text | nomatch | If the input is not a 1-, 2-, 3- or 4-digit year or decade, output the "nomatch" value. Defaults to blank. | String | optional |
See also
- Template:Title year
- Template:Title year range
- Template:Title decade
- Template:Century name from title year
- Template:Century name from title decade