Template:Century name from decade or year/doc: Difference between revisions
Appearance
Content deleted Content added
re-order |
→Errors: add |
||
Line 27: | Line 27: | ||
== Errors == |
== Errors == |
||
Empty or inappropriate parameters produce no output |
Empty or inappropriate parameters produce no output, unless the "nomatch" paremeter is et. |
||
* <code><nowiki>{{Century name from decade or year}}</nowiki></code> → {{Century name from decade or year}} |
* <code><nowiki>{{Century name from decade or year}}</nowiki></code> → {{Century name from decade or year}} |
||
* <code><nowiki>{{Century name from decade or year|265}}</nowiki></code> → {{Century name from decade or year|265}} |
* <code><nowiki>{{Century name from decade or year|265}}</nowiki></code> → {{Century name from decade or year|265}} |
||
* <code><nowiki>{{Century name from decade or year|French flying flamingoes flounce furiously}}</nowiki></code> → {{Century name from decade or year|French flying flamingoes flounce furiously}} |
* <code><nowiki>{{Century name from decade or year|French flying flamingoes flounce furiously}}</nowiki></code> → {{Century name from decade or year|French flying flamingoes flounce furiously}} |
||
With "nomatch" |
|||
* <code><nowiki>{{Century name from decade or year|nomatch=FAILED}}</nowiki></code> → {{Century name from decade or year|nomatch=FAILED}} |
|||
* <code><nowiki>{{Century name from decade or year|265|nomatch=Aaaaaaaaaargh}}</nowiki></code> → {{Century name from decade or year|265|nomatch=Aaaaaaaaaargh}} |
|||
* <code><nowiki>{{Century name from decade or year|French flying flamingoes flounce furiously|nomatch=NOMATCH}}</nowiki></code> → {{Century name from decade or year|French flying flamingoes flounce furiously|nomatch=NOMATCH}} |
|||
== TemplateData == |
== TemplateData == |
Revision as of 14:43, 10 March 2020
This is a documentation subpage for Template:Century name from decade or year. It may contain usage information, categories and other content that is not part of the original template page. |
When supplied with a 4-digit year or a 4-digit decade, returns the name of the century.
Mostly used in categorisation.
Parameters
- The first parameter is required: either a a 4-digit year (e.g. 1859) or a 4-digit decade (e.g. 1970s)
- 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|1707}}
→ 18th century{{Century name from decade or year|1514|dash}}
→ 16th-century{{Century name from decade or year|1920s}}
→ 16th century{{Century name from decade or year|2030s|dash}}
→ 21st-century
Errors
Empty or inappropriate parameters produce no output, unless the "nomatch" paremeter is et.
{{Century name from decade or year}}
→{{Century name from decade or year|265}}
→ 3rd century{{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|265|nomatch=Aaaaaaaaaargh}}
→ 3rd century{{Century name from decade or year|French flying flamingoes flounce furiously|nomatch=NOMATCH}}
→ NOMATCH
TemplateData
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Century name from decade or year in articles based on its TemplateData.
TemplateData for Century name from decade or year
Returns the name of the century for a 4-digit year or a 4-digit decade.
Parameter | Description | Typ | Status | |
---|---|---|---|---|
Year or decade | 1 | a 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 4-digit year or a 4-digit decade, output the "nomatch" value. Defaults to blank. | String | optional |
See also
- {{Title year}}
- {{Title decade}}