“Template:Weather inline”的版本间的差异

来自Stardew Valley Wiki
跳到导航 跳到搜索
(sync with english template)
第1行: 第1行:
<includeonly>{{#switch: {{lc:{{{value|{{{1|}}}}}}}}
+
<includeonly><!--
| 晴天 | | sunny | sun = [[File:Sunny.png]]&nbsp;[[天气| 晴天]]
+
// Define the list of recognized weather names
| 雨天 | | rain | rainy = [[File:Rain.png]]&nbsp;[[天气|雨天]]
+
//  First column=icon name -> same in all languages
| 落叶 | 花粉 | | 刮风 | polleny | pollen | wind | windy = [[File:Pollen_fall.png]]&nbsp;[[天气| 花粉]]
+
//  Second column=displayed text -> needs translation
| springwind = [[File:Pollen spring.png|link=]]&nbsp;[[天气| 风]]
+
//  All other values are synonyms
| 暴风雨 | 风暴 | stormy | storm = [[File:Thunderstorm.png]]&nbsp;[[天气| 风暴]]
+
-->{{ParseInputValues|code=weather||
| 雪天 | 下雪 | snowy| snow = [[File:Snow.png]]&nbsp;[[ 天气| 下雪]]
+
,Any,      任何, All,  Always,
| #default = <span style="color:red">WEATHER TEMPLATE ERROR</span>
+
,Sunny,     晴天, Sun,  晴,   
}}</includeonly><noinclude>{{englishdoc}}</noinclude>
+
,Pollen fall,  风, Wind,  Pollen, Polleny, Windy, 花粉, 落叶, 刮风,
 +
,Pollen spring, 风,  Wind,  Springwind,
 +
,Rain,      雨天, Rainy, 雨,   
 +
,Thunderstorm,  风暴, Storm, Stormy, 暴风雨,  
 +
,Snow,      下雪, Snowy, 雪天,
 +
}}<!--
 +
// 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}}}}<!--
 +
 
 +
// On first entry, add sort-key if requested. On other entries, add space and bullet.
 +
-->{{#ifexpr:{{#arraysearch:$wweather|@weather@}}>0
 +
   |&#32;•&#32;
 +
   |{{#if:{{{sortkey|}}}|
 +
     <span class="sortkey" style="display:none;">{{#if:{{#arrayprint:$wlink_text}}
 +
  |{{#expr:{{ParseInputValues|code=weather|@weather@|translate=index}}+1}}
 +
  |0}}</span>
 +
  }}}}<span style="display:inline; margin-right:0; white-space: nowrap"><!--
 +
 
 +
// 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=]]&nbsp;}}<!--
 +
 
 +
// Add link
 +
-->[[{{#arrayprint:$lang_weatherlink}}|{{#arrayprint:$wlink_text}}]]<!--
 +
-->}}}}</span>}}}}</includeonly><noinclude>{{Englishdoc}}{{#ifexist:{{FULLPAGENAME}}/doc |<nowiki/>
 +
{{{{FULLPAGENAME}}/doc}} }}</noinclude>

2020年10月3日 (六) 18:50的版本

有关此模板的详细信息,请参阅英语语言文档页

用法

可以通过在相关页面上输入以下内容来使用此模板。

{{Weather inline}}

结果是... Template:ParseInputValues[[File:Template:ParseInputValues.png|

      | link=天气| alt=]] [[天气|Template:ParseInputValues]]