跳去內容

Template:Duration/doc

出自維基百科,自由嘅百科全書

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:

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
  • Red XN {{Duration|h=one|m=22|s=0}} renders as: 表達錯: 未預料嘅字 "one"
  • Red XN {{Duration|h=1|m=22|s=78}} renders as: Error: 's' must not be greater than 59.
  • Red XN {{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
  • Red XN {{Duration|1|22|}} renders as: 表達錯: 缺少 > 嘅運算符
  • {{Duration|0|0|0}} renders as: (blank)
  • {{Duration|||}} renders as: (blank)
  • Red XN {{Duration|1|22|34|55}} renders as: Error: Parameter number 4 should not be specified.
  • Red XN {{Duration|one|22|0}} renders as: 表達錯: 未預料嘅字 "one"
  • Red XN {{Duration|1|22|78}} renders as: Error: 's' must not be greater than 59.
  • Red XN {{Duration|1.1|2.2}} renders as: Error: 'h' and 'm' values must be integers.

Microformat

[編輯]

Template:UF-audio-part

TemplateData

[編輯]
呢個係用喺呢個模嘅TemplateData解,用喺VisualEditor同埋其它工具度;睇吓呢個模嘅每月錯誤報告

TemplateData for Duration嘅TemplateData

For use in templates emitting the hAudio [[microformat]]

模參數

呢塊模建議一行過寫晒所有參數。

參數描述狀態
Hoursh 1

無描述

範例
3
數字建議
Minutesm 2

無描述

範例
32
數字建議
Secondss 3

無描述

範例
42
數字建議