Difference between revisions of "Template:Century name from title decade/doc"
Jump to navigation
Jump to search
imported>BrownHairedGirl |
imported>BrownHairedGirl |
||
| Line 18: | Line 18: | ||
* <code><nowiki>{{Century name from title decade|dash}}</nowiki></code><br />When used on e.g. [[:Category:1970s in Northern Ireland]], returns → {{nowrap|<code>20th-century</code>}} | * <code><nowiki>{{Century name from title decade|dash}}</nowiki></code><br />When used on e.g. [[:Category:1970s in Northern Ireland]], returns → {{nowrap|<code>20th-century</code>}} | ||
* <code><nowiki>{{Century name from title decade}}</nowiki></code><br />When used on e.g. [[:Category:Belfast]], returns → {{nowrap|<code></code>}} | * <code><nowiki>{{Century name from title decade}}</nowiki></code><br />When used on e.g. [[:Category:Belfast]], returns → {{nowrap|<code></code>}} | ||
| − | * <code><nowiki>{{Century name from title decade|nomatch=FAIL}}</nowiki></code><br />When used on e.g. [[:Category: | + | * <code><nowiki>{{Century name from title decade|nomatch=FAIL}}</nowiki></code><br />When used on e.g. [[:Category:Ballymena]], returns → {{nowrap|<code>FAIL</code>}} |
== Implementation == | == Implementation == | ||
Revision as of 17:10, 16 March 2020
| 40px | This is a documentation subpage for Template:Century name from title decade. It contains usage information, categories and other content that is not part of the original template page. |
Extracts a 4-digit decade from the current page title, and returns the name of the century in which that year was.
Usage
{{Century name from title decade}}
Mostly used in categorisation.
Parameters
All parameters are optional
- The single word "dash" changes the output from "nth century" to "nth-century"
- A "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
Examples
{{Century name from title decade}}
When used on e.g. Category:2010s in Northern Ireland, returns →21st century{{Century name from title decade|dash}}
When used on e.g. Category:1970s in Northern Ireland, returns →20th-century{{Century name from title decade}}
When used on e.g. Category:Belfast, returns →{{Century name from title decade|nomatch=FAIL}}
When used on e.g. Category:Ballymena, returns →FAIL
Implementation
This template is implemented by using {{Century name from decade or year}} around {{Title decade}}.
The same effect can be achieved by using {{Century name from decade or year|{{Title decade}}s}} ... but this wrapper makes more easily-read markup
See also
- Template:Title year range
- Template:Title decade
- Template:Title century
- Template:Century name from decade or year
- Template:Century name from title year