“Template:Duration”的版本间的差异
跳到导航
跳到搜索
(document) |
小 |
||
第1行: | 第1行: | ||
− | <includeonly><templatestyles src="Template:Duration/styles.css" /><span class="durationtemplate{{#ifeq:{{{class|}}}|inline|inline|}}">[[File:Time Icon.png|24px|link=]] | + | <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> |
==描述== | ==描述== | ||
该模板用于输出时间,输出时会自动在文本中插入时间的图标:[[File:Time Icon.png|24px]] [[:File:Time Icon.png]]。 | 该模板用于输出时间,输出时会自动在文本中插入时间的图标:[[File:Time Icon.png|24px]] [[:File:Time Icon.png]]。 | ||
第51行: | 第51行: | ||
例子: | 例子: | ||
− | <pre>{{Duration| | + | <pre>{{Duration|3d14h15m9s}}</pre> |
实际显示效果为: | 实际显示效果为: | ||
− | {{Duration| | + | {{Duration|3d14h15m9s}} |
<pre>{{Duration|180m (3h)}}</pre> | <pre>{{Duration|180m (3h)}}</pre> |
2023年4月26日 (三) 12:16的版本
描述
该模板用于输出时间,输出时会自动在文本中插入时间的图标: File:Time Icon.png。
用法
将下列文本放置在页面中。
{{Duration|时间长度}}
实际显示效果为: 时间长度
禁用自动换行
可插入参数class=inline
禁用自动换行。
例子:
正常情况下持续时间为{{Duration|11m 25s|class=inline}},但某些条件下可将时间延长至{{Duration|25m|class=inline}}。
实际显示效果为:
正常情况下持续时间为 11分钟25秒,但某些条件下可将时间延长至 25分钟。
中文单位转换
该模板会自动删除所有空格符号。如果给定的文本包括英语的时间单位时,将自动将其转换为对应的中文单位:
时间单位 | 自动替换为 |
---|---|
d | 天 |
min | 分钟 |
m | 分钟 |
h | 小时 |
s | 秒 |
( | ( |
) | ) |
例子:
{{Duration|3d14h15m9s}}
实际显示效果为:
3天14小时15分钟9秒
{{Duration|180m (3h)}}
实际显示效果为:
180分钟(3小时)
也见
有关此模板的详细信息,请参阅英语语言文档页。
用法
可以通过在相关页面上输入以下内容来使用此模板。
{{Duration}}
结果是...