行 1: |
行 1: |
− | <includeonly><templatestyles src="Template:Duration/styles.css" /><span class="durationtemplate{{#ifeq:{{{class|}}}|inline|inline|}}">[[File:Time Icon.png|24px|link=]] {{#replace:{{#replace:{{#replace:{{#replace:{{#replace:{{#replace:{{#replace:{{#replace:{{{1|}}}|d|天}}|min|分钟}}|m|分钟}}|h|小时}}|s|秒}}|(|(}}|)|)}}| |}}</span></includeonly><noinclude> | + | <includeonly><templatestyles src="Template:Duration/styles.css" /><span class="durationtemplate{{#ifeq:{{{class|}}}|inline|inline|}}">[[File:Time Icon.png|24px|link=]] {{{1|}}}</span></includeonly><noinclude>{{Englishdoc}}</noinclude> |
− | ==描述==
| |
− | 该模板用于输出时间,输出时会自动在文本中插入时间的图标:[[File:Time Icon.png|24px]] [[:File:Time Icon.png]]。
| |
− | | |
− | ==用法==
| |
− | 将下列文本放置在页面中。
| |
− | | |
− | <pre>{{Duration|时间长度}}</pre>
| |
− | | |
− | 实际显示效果为:
| |
− | {{Duration|时间长度}}
| |
− | | |
− | ===禁用自动换行===
| |
− | 可插入参数<code>class=inline</code>禁用自动换行。
| |
− | | |
− | 例子:
| |
− | <pre>正常情况下持续时间为{{Duration|11m 25s|class=inline}},但某些条件下可将时间延长至{{Duration|25m|class=inline}}。</pre>
| |
− | | |
− | 实际显示效果为:
| |
− | | |
− | 正常情况下持续时间为{{Duration|11m 25s|class=inline}},但某些条件下可将时间延长至{{Duration|25m|class=inline}}。
| |
− | | |
− | ===中文单位转换===
| |
− | 该模板会自动删除所有空格符号。如果给定的文本包括英语的时间单位时,将自动将其转换为对应的中文单位:
| |
− | {| class="wikitable" style="text-align: center;"
| |
− | |-
| |
− | ! 时间单位
| |
− | ! 自动替换为
| |
− | |-
| |
− | | d
| |
− | | 天
| |
− | |-
| |
− | | min
| |
− | | 分钟
| |
− | |-
| |
− | | m
| |
− | | 分钟
| |
− | |-
| |
− | | h
| |
− | | 小时
| |
− | |-
| |
− | | s
| |
− | | 秒
| |
− | |-
| |
− | | (
| |
− | | (
| |
− | |-
| |
− | | )
| |
− | | )
| |
− | |}
| |
− | | |
− | 例子:
| |
− | <pre>{{Duration|3d14h15m9s}}</pre>
| |
− | | |
− | 实际显示效果为:
| |
− | | |
− | {{Duration|3d14h15m9s}}
| |
− | | |
− | <pre>{{Duration|180m (3h)}}</pre>
| |
− | | |
− | 实际显示效果为:
| |
− | | |
− | {{Duration|180m (3h)}}
| |
− | | |
− | ==也见==
| |
− | {{Englishdoc}}</noinclude> | |