Template:時間長度
呢個模用到Lua語言: |
This template emits the hAudio microformat.
Usage
編輯Unformatted input
編輯An unformatted duration can be input in the first parameter: {{Duration|10:20:30}}
(hours:minutes:seconds) or {{Duration|20:30}}
(minutes:seconds). There must be a seconds value, as inputs in hours and minutes are indistinguishable from inputs in minutes and seconds.
Numbered parameters
編輯{{Duration|10|20|30}}
where parameters are hours, minutes and seconds respectively. If the hours or minutes values are zero, then leave them blank (e.g. {{Duration||20|30}}
). Minutes and seconds values default to zero, although they should ideally be specified.
h, m and s parameters
編輯{{Duration|h=10|m=20|s=30}}
where h, m and s are hours, minutes and seconds respectively. Minutes and seconds values default to zero, although they should ideally be specified.
Parent templates
編輯This template can be used in:
- {{Infobox album}}
- {{Infobox song}}
In {{Infobox album}}, the microformat is added automatically if there is not one already. However, more complicated values might require this template.
Examples
編輯Unformatted input
編輯{{Duration|1:22:34}}
renders as: 表達錯: 未能認得到嘅標點 ":"{{Duration|74:32}}
renders as: 表達錯: 未能認得到嘅標點 ":"{{Duration|1:02:34}}
renders as: 表達錯: 未能認得到嘅標點 ":"{{Duration|1:2:3}}
renders as: 表達錯: 未能認得到嘅標點 ":"{{Duration|0:22:34}}
renders as: 表達錯: 未能認得到嘅標點 ":"{{Duration|0:0:34}}
renders as: 表達錯: 未能認得到嘅標點 ":"{{Duration|0:34}}
renders as: 表達錯: 未能認得到嘅標點 ":"
h, m and s parameters
編輯{{Duration|h=1|m=22|s=34}}
renders as: 1:22:34{{Duration|m=74|s=32}}
renders as: 74:32{{Duration|m=2|s=34}}
renders as: 2:34{{Duration|h=1|s=34}}
renders as: 1:00:34{{Duration|h=1}}
renders as: 1:00:00{{Duration|h=0|m=22|s=34}}
renders as: 0:22:34{{Duration|h=0|m=0|s=34}}
renders as: 0:00:34{{Duration|h=1|m=22|s=34.5678}}
renders as: 1:22:34.5678{{Duration|h=1|m=22|s=3}}
renders as: 1:22:03{{Duration|h=1|m=2|s=34}}
renders as: 1:02:34{{Duration|h=1|m=2|s=3}}
renders as: 1:02:03{{Duration|h=1|m=2}}
renders as: 1:02:00{{Duration|s=34}}
renders as: 0:34{{Duration|m=0|s=34}}
renders as: 0:34{{Duration|h=1|m=0|s=34}}
renders as: 1:00:34{{Duration|h=1|m=22|s=0}}
renders as: 1:22:00-
{{Duration|h=one|m=22|s=0}}
renders as: 表達錯: 未預料嘅字 "one" -
{{Duration|h=1|m=22|s=78}}
renders as: Error:'s'
must not be greater than 59. -
{{Duration|h=1.1|m=2.2}}
renders as: Error:'h'
and'm'
values must be integers.
Numbered parameters
編輯{{Duration|1|22|34}}
renders as: 1:22:34{{Duration||74|32}}
renders as: 74:32{{Duration|1|2|34}}
renders as: 1:02:34{{Duration|1|2|3}}
renders as: 1:02:03{{Duration|0|22|34}}
renders as: 0:22:34{{Duration|0|0|34}}
renders as: 0:00:34{{Duration||0|34}}
renders as: 0:34{{Duration|||34}}
renders as: 0:34{{Duration|1|22|34.5678}}
renders as: 1:22:34.5678{{Duration||1|22}}
renders as: 1:22{{Duration|1|22}}
renders as: 1:22:00{{Duration|1|22|0}}
renders as: 1:22:00-
{{Duration|1|22|}}
renders as: 表達錯: 缺少 > 嘅運算符 {{Duration|0|0|0}}
renders as: (blank){{Duration|||}}
renders as: (blank)-
{{Duration|1|22|34|55}}
renders as: Error: Parameter number 4 should not be specified. -
{{Duration|one|22|0}}
renders as: 表達錯: 未預料嘅字 "one" -
{{Duration|1|22|78}}
renders as: Error:'s'
must not be greater than 59. -
{{Duration|1.1|2.2}}
renders as: Error:'h'
and'm'
values must be integers.
Microformat
編輯TemplateData
編輯For use in templates emitting the hAudio [[microformat]]
參數 | 描述 | 類 | 狀態 | |
---|---|---|---|---|
Hours | h 1 | 無描述
| 數字 | 建議 |
Minutes | m 2 | 無描述
| 數字 | 建議 |
Seconds | s 3 | 無描述
| 數字 | 建議 |
上面嘅解係穿透包含咗自Template:時間長度/doc。 (改 | 史) 編者可以響呢個模嘅沙盤 (開 | 鏡)同埋試例 (開)版度試驗佢。 請加個類到個/doc嘅細版度。 呢個模嘅細版。 |