模板:Categories by date
外观
使用
[编辑]給編輯者
[编辑]普通使用
[编辑]使用該系統的所有模板具有相同的用法。輸出將根據您提供的信息而變化:
- 「年」類型:須提供century、decade和year的值。
- 「年代」類型:須提供century和decade的值。
- 「世紀」類型:只提供century的值。
舉例:
1985年:
{{births by year
|century = 19
|decade = 8
|year = 5
}}
1980年代:
{{births by year
|century = 19
|decade = 8
|year =
}}
20世紀:
{{births by year
|century = 19
|decade =
|year =
}}
50年:
{{births by year
|century =
|decade = 5
|year = 0
}}
前1250年代:
{{births by year
|century = 12
|decade = 5
|year =
|era = BCE
}}
1世紀
[编辑]在(前)1世紀、(前)0年代時,需要視情況將century和decade留空,因為數字不存在(例如,第5年沒有十位數)。
0年代(包含西元1年~9年)
{{births by year
|century =
|decade = 0
|year =
}}
1世紀
{{births by year
|century =
|decade =
|year =
}}
給開發者
[编辑]注意:
此模板不應由普通編輯直接修改;如果您要查找{{births by year}}等模板上的文檔,請參閱上面的章節。 目前,以下模板使用此系統:
使用
[编辑]此模板用作特定模板的一部分,如{{deaths by year}},以生成日期類別(世紀,年代,年份)的列表。 它從提供的信息量中推斷出深度。 以下代碼是標準代碼(可根據需要更改數值):
{{categories by date
|century = {{{century}}}
|decade = {{{decade}}}
|year = {{{year}}}
|caption = Authors who died
|name = deaths
|parentcat = Authors by date
|era = {{#switch:{{{era|}}}|BCE|BC=BCE}}
}}
- {{{century}}}、{{{decade}}}、{{{year}}}:日期分為世紀,年代和年份三個數字。
- {{{caption}}}:用作類別描述的一部分的文字。在中文版大多不使用。
- {{{name}}}:類別中使用的文字。耴[[Category:1986年{逝世}]]。
- {{{parentcat}}}:包含當前日期類別系統的母分類。
- {{{era}}}:切換是否將“BCE”添加到類別名稱。
嵌套模板
[编辑]此模板使用嵌套模板{{categories by date/list}}來生成類別列表。這個嵌套模板以最小化計算的方式操作參數:
- {{{1}}} (prefix digits): the digits of the year, excepting the last number.
- {{{2}}} (suffix): text to add after the date; for example, s in 1980s works.
- {{{3}}} (category label): the text in the category names; for example, works in 1980 works.
- {{{4}}} (era):是否加入「前」。
| Purpose | Code | Output | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Common era | ||||||||||||
| list years | {{categories by date/list|198||deaths}}
|
|||||||||||
| list decades | {{categories by date/list|19|0s|deaths}}
|
|||||||||||
| Before common era | ||||||||||||
| list years | {{categories by date/list|50||deaths|BCE}}
|
|||||||||||
| list decades | {{categories by date/list|5|0s|deaths|BCE}}
|
|||||||||||