Template:Century name from decade or year
外观
![本页使用了标题或全文手工转换](http://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Zh_conversion_icon_m.svg/35px-Zh_conversion_icon_m.svg.png)
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|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}}
範例
[编辑]{{Century name from decade or year|8}}
→ 1世紀{{Century name from decade or year|63}}
→ 1世紀{{Century name from decade or year|421}}
→ 5世紀{{Century name from decade or year|1707}}
→ 18世紀{{Century name from decade or year|0年代}}
→ 1世紀{{Century name from decade or year|40年代}}
→ 1世紀{{Century name from decade or year|550年代}}
→ 6世紀{{Century name from decade or year|1920年代}}
→ 20世紀
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}}
→ 1世紀{{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}}
→ 1世紀{{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
Redirects
[编辑]TemplateData
[编辑]Returns the name of the century for a 1-, 2-, 3- or 4-digit year or decade.
参数 | 描述 | 类型 | 状态 | |
---|---|---|---|---|
Year or decade | 1 | a 1-, 2-, 3- or 4-digit-year (e.g. '1957') or a 4-digit-decade (e.g. '1760s')
| 数字 | 可选 |
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. | 字符串 | 可选 |
See also
[编辑]- Template:Title year
- Template:Title year range
- Template:Title decade
- Template:Century name from title year
- Template:Century name from title decade
上述文档嵌入自Template:Century name from decade or year/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。本模板的子页面。 |