Template:Title century
This template is used on many pages, so changes to it will be widely noticed. Please test any changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Please consider discussing changes on the talk page before implementing them. |
This template uses Lua: |
Extracts a century number from a page title.
It recognises two formats:
- With a separating dash: XXth-century, e.g. "14th-century electric toasters" or "2nd-century hang-gliders"
- With a separating space: XXth century, e.g. "21st century in Doohoma" or "Aviation disasters in the 3rd century"
Note that unlike {{Title year}} and {{Title decade}}, it always takes the first century number in the title.
Usage
{{Title century}}
or
{{Title century|match=|nomatch=|page=}}
Examples
{{Title century|page=Category:17th-century hoaxes}}
→ 17{{Title century|page=Category:21st century in Ballyporeen}}
→ 21{{Title century|page=18 century in }}
→ 21{{Title century|page=13th-century time-travellers to the 20th century}}
→ 13{{Title century|page=1701–1799 quidditch season}}
→{{Title century|nomatch=NOTFOUND|page=1701–1799 quidditch season}}
→ NOTFOUND{{Title century|page=100 worst internet memes during the reign of Tutankhamen}}
→{{Title century|page=List of antidisestablishmentarian riots in Xanadu by century}}
→{{Title century|nomatch=NONSENSE|page=List of antidisestablishmentarian riots in Xanadu by century}}
→ NONSENSE
If you want to recreate the "xxth century" in the title (after 0 AD) then you can use this template to create a year to feed into {{Century name from decade or year}} :
{{Century name from decade or year|{{Title century|page=Category:20th-century hoaxes}}00}}
→ 20th century{{Century name from decade or year|{{Title century|page=Category:21st-century hoaxes}}00|dash}}
→ 21st-century
TemplateData
TemplateData for Title century
<templatedata> { "params": { "1": { "aliases": [ "nomatch" ], "label": "No match text", "description": "If no century number is found, output the \"nomatch\" value. Defaults to blank.", "type": "string" }, "page": { "label": "Override page title", "description": "Specified a page title to use other than the current page. If left blank, the template will use the title of the current page", "type": "wiki-page-name", "default": "Title century" } }, "description": "Extracts a century number from the current page title. All parameters are optional." } </templatedata>
See also
- Template:Title monthname
- Template:Title year
- Template:Title decade
- Template:Title year range
- Template:Century name from decade or year
The above documentation is transcluded from Template:Title century/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |