模板:Weather inline:修订间差异
来自星露谷物语扩展百科
更多语言
更多操作
删除的内容 添加的内容
Margotbean(留言 | 贡献) +festival |
m无编辑摘要 |
||
| (未显示2个用户的7个中间版本) | |||
| 第1行: | 第1行: | ||
| ⚫ | |||
<includeonly><!-- |
|||
|all|any|both|任何|任意 = [[s:天气|任意天气]] |
|||
// Define the list of recognized weather names |
|||
|sun|sunny|晴天|晴 = [[File:Sunny.png|{{{width|16px}}}|link=]] [[s:天气|晴天]] |
|||
// First column=icon name -> same in all languages |
|||
|springwind = [[File:Pollen spring.png|{{{width|16px}}}|link=]] [[s:天气|风]] |
|||
// Second column=displayed text -> needs translation |
|||
|rain|rainy|雨|雨天 = [[File:Rain.png|{{{width|16px}}}|link=]] [[s:天气|雨天]] |
|||
// All other values are synonyms |
|||
|festival|节日 = [[File:Festival.png|{{{width|16px}}}|link=]] [[s:节日]] |
|||
-->{{ParseInputValues|code=weather|| |
|||
|fallwind = [[File:Pollen fall.png|{{{width|16px}}}|link=]] [[s:天气|风]] |
|||
,Any, 任何, All, Always, 任意, |
|||
|storm|暴风雨|风暴 = [[File:Thunderstorm.png|{{{width|16px}}}|link=]] [[s:天气|雷雨]] |
|||
,Sunny, 晴天, Sun, 晴, |
|||
|snow|下雪|雪天 = [[File:Snow.png|{{{width|16px}}}|link=]] [[s:天气|下雪]] |
|||
,Pollen fall, 风, Wind, Pollen, Polleny, Windy, 花粉, 落叶, 刮风, |
|||
|#default = {{ucfirst:{{{1|}}} }} |
|||
,Pollen spring, 风, Wind, Springwind, |
|||
| ⚫ | |||
,Rain, 雨天, Rainy, 雨, |
|||
,Thunderstorm, 风暴, Storm, Stormy, 暴风雨, |
|||
,Snow, 下雪, Snowy, 雪天, |
|||
,Festival, 节日 |
|||
}}<!-- |
|||
// The name of the weather wiki page |
|||
-->{{#arraydefine:$lang_weatherlink|天气}}<!-- |
|||
// END OF translated text |
|||
// Check whether there's already a file link in {{{1}}}... implying this is probably a recursive call. Return immediately |
|||
-->{{#if:{{#pos:{{{1|}}}|{{Bracket|2}}File}}|{{{1}}}|<!-- |
|||
// Parse input data, then loop over all extracted entries |
|||
-->{{#arraydefine:$wweather|{{ParseInputValues|code=weather|{{{1|}}}|default=true}}}}<!-- |
|||
-->{{#arrayprint:$wweather||@weather@|<!-- |
|||
// Convert @weather@ (icon name) into displayed text |
|||
-->{{#arraydefine:$wlink_text|{{ParseInputValues|code=weather|@weather@|translate=true}}}}<!-- |
|||
// Wrap a sort-key span around all items if requested. On other entries, add {{{space}}} or bullet. |
|||
-->{{#ifexpr:{{#arraysearch:$wweather|@weather@}}>0 |
|||
|{{{space| • }}} |
|||
|{{#ifexpr:{{#if:{{{sortkey|}}}|1|0}} or {{#ifeq:{{{sortkey}}}||1|0}} |
|||
|<span data-sort-value="{{#ifeq:{{{sortkey}}}|||{{#ifeq:{{{sortkey|true}}}|true |
|||
|{{#expr:{{#if:{{#arrayprint:$wlink_text}} |
|||
|({{ParseInputValues|code=weather|@weather@|translate=index}}+1) |
|||
|0}}}} |
|||
|{{{sortkey|}}}}}}}"> |
|||
| ⚫ | |||
// Display unmatched text (detected by empty value for $wlink_text) |
|||
// And also handle text_only option |
|||
-->{{#ifeq:{{#arrayprint:$wlink_text}}| |
|||
| {{ucfirst:@weather@}} |
|||
| {{#if:{{{text_only|}}} |
|||
| {{#if:{{{no_translate|}}}|@weather@|{{#arrayprint:$wlink_text}}}} |
|||
| <!-- |
|||
// Display the normal cases: first display icon (except for Any) |
|||
-->{{#ifeq:@weather@|Any||[[File:@weather@.png| |
|||
{{#if:{{{size|}}}|{{{size}}}px}} | link={{#arrayprint:$lang_weatherlink}}| alt=]] }}<!-- |
|||
// Add link |
|||
-->[[{{#arrayprint:$lang_weatherlink}}|{{#arrayprint:$wlink_text}}]]<!-- |
|||
-->}}}}</span>}}<!-- |
|||
-->{{#ifexpr:{{#if:{{{sortkey|}}}|1|0}} or {{#ifeq:{{{sortkey}}}||1|0}}|</span>}} |
|||
| ⚫ | |||
2026年1月14日 (三) 01:55的最新版本
描述
此模板用于根据输入参数显示一个天气图标和对应的天气名称链接。主要用于信息框或表格中,以简洁的方式展示天气信息。
用法
使用以下代码来调用模板:
{{Weather inline|天气状况}}
若要自定义图标大小:
{{Weather inline|天气状况|width=图标宽度}}
参数
{{{1}}}(匿名参数)- 必填。用于指定天气状况。此参数不区分大小写。可接受的值如下:
sun, sunny, 晴天, 晴- 显示晴天图标和链接。rain, rainy, 雨, 雨天- 显示雨天图标和链接。storm, 暴风雨, 风暴- 显示雷雨图标和链接。snow, 下雪, 雪天- 显示雪天图标和链接。springwind- 显示春季有花粉的刮风图标和链接。fallwind- 显示秋季有落叶的刮风图标和链接。all, any, both, 任何, 任意- 显示“任意天气”的文本链接。festival, 节日- 显示节日图标和链接。
width- 选填。用于指定图标的宽度,单位为像素。如果省略,则默认为 16px。
示例
| 输入代码 | 显示效果 |
|---|---|
{{Weather inline|sun}}
|
|
{{Weather inline|暴风雨|width=24px}}
|
|
{{Weather inline|任意}}
|
任意天气 |
{{Weather inline|festival}}
|
[ 查看 | 编辑 | 历史 | 刷新 ]上述文档的内容来自模板:Weather inline/doc。