模板:Duration:修订间差异
来自星露谷物语扩展百科
更多语言
更多操作
m无编辑摘要 |
document |
||
| 第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:{{{1|}}}|d|天}}|min|分钟}}|m|分钟}}|h|小时}}|s|秒}}|(|(}}|)|)}}</span></includeonly><noinclude>{{Englishdoc}}</noinclude> | <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:{{#replace:{{{1|}}}|d|天}}|min|分钟}}|m|分钟}}|h|小时}}|s|秒}}|(|(}}|)|)}}| |}}|(\d+)(?=分)|$1分钟}}</span></includeonly><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|3d14h15m92s}}</pre> | |||
实际显示效果为: | |||
{{Duration|3d14h15m92s}} | |||
<pre>{{Duration|180m (3h)}}</pre> | |||
实际显示效果为: | |||
{{Duration|180m (3h)}} | |||
==也见== | |||
{{Englishdoc}}</noinclude> | |||
2023年4月26日 (三) 13:53的版本
描述
该模板用于输出时间,输出时会自动在文本中插入时间的图标:
File:Time Icon.png。
用法
将下列文本放置在页面中。
{{Duration|时间长度}}
实际显示效果为:
时间长度
禁用自动换行
可插入参数class=inline禁用自动换行。
例子:
正常情况下持续时间为{{Duration|11m 25s|class=inline}},但某些条件下可将时间延长至{{Duration|25m|class=inline}}。
实际显示效果为:
正常情况下持续时间为
11m 25s,但某些条件下可将时间延长至
25m。
中文单位转换
该模板会自动删除所有空格符号。如果给定的文本包括英语的时间单位时,将自动将其转换为对应的中文单位:
| 时间单位 | 自动替换为 |
|---|---|
| d | 天 |
| min | 分钟 |
| m | 分钟 |
| h | 小时 |
| s | 秒 |
| ( | ( |
| ) | ) |
例子:
{{Duration|3d14h15m92s}}
实际显示效果为:
3d14h15m92s
{{Duration|180m (3h)}}
实际显示效果为:
180m (3h)